correct use of xppattr and attr()

I am struggling to get something to work and wondered if someone could point me in the right direction?

I need to call a XyPerl subroutine in the ::before tag to set something up which will allow me to alter whether the paragraph is centered or range left. There is a counter which is set that allows me to test and use an if / else statement so I can then use the xppattr to load different values.

Then I need to use the attr() function to the text-align property in the main para to change to the relevant value.

However everything I have tried, and believe me I have tried many things, does not seem to change anyhting.

Parents Reply
  • Chris,

    Here is my solution to your problem.
    This is the test division:

    here is the CSS:

    And here is the perl:

    I have switched to the numeric argument for the text-align just because the built-in xpp:ta attribute (used in the cals_t5.css) is numeric
    I will try soon to see if it works also as a string (which I think it should - but hey need to test first).

    Also note that you have to escape the : in the css as it is a special character. So the xpp attribute should be called out as xpp\:

    Another thing to note is that when you use your own xpp attribute  in the CSS you should always specify what kind of value it returns. Hence my attr(xpp\:fred integer);

    Now testing with a string...

Children