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 Children
  • CSS/Perl code snippet, please?

    Or in other words, what have you tried to do?

    Jonathan Dagresta
    RWS Group/
    XPP Development

  • Hi Jonathan

    I think I need to reword the question differently. Using the text-align example above I have managed to get the routine to accept a variable and it does what it should (so that is working). However when I try to use a variable to change the font-size I can't get it to work and instead it "defaults" to 12pt (which is not the size it is inheriting). Having said all of that, that is not what I am trying to use other than "proving" the process.

    What I really need to do is calculate the value of !bx + !bwidth + 10mm so I can change the width in a frill (which has an XML element in it). Currently I don't seem to be able to change the width at all even using a set number rather than a variable (even in the main text blocks let alone a frill block). Yet more complex I will need to do a calculation, based of %blines, which is stored in several places, to calculate the value for a vertical move (vm macro).

    The only way I can see of doing this is to revert totally to "macros" for these routines which I am desperately trying to avoid and instead do this in the modern way (which is what the brief is) - unfortunately this is working perfectly in the item format world using a Perl module but of course you can initiate all these cahnges in the pre-process after the defaults of the item format rule have been read in - CSS works the other way round and overwrites any calculations that may have been arrived at.

    Any suggestions as to "recommended process" would be very much appreciated.

    Chris

  • Hi Chris,

    Appreciate your further explanation.

    I still cannot offer any suggestions unless you provide some code snippets showing exactly what you are trying to do.

    When you say you are "trying to change the width in a frill", do you mean trying to change the measure?

    In any case, it sounds like this is heading down the path of needing so many details about your setup that you may need to open a ticket with support so that you can provide a Job Archive.

    Jonathan Dagresta
    RWS Group/
    XPP Development

  • Chris,

    As far as I could follow your explanation this seems to be a pure XyPerl problem.
    I am guessing that you are doing some calculations inside XyPerl and want to use the result in a vertical move?
    Correct?

    If so, don't forget that you need to qualify whatever you send back from the XyPerl world to the compose world.
    So lets say your calculated depth is sitting in the variable $depth then you have to do the follwing:

       $X->vm("${depth}n");

    The 'n' will tell XPP that these are microns.
    Does that help you?

  • Hi Bart

    Unfortunately that is not the solution.

    We have a para::before where calculations are being performed but when we get to para they are being overwritten and/or we can't access them properly using the xppattr/attr values. In the IF world the values are read in and then can be overwritten in the preprocess - in CSS its the other way round and we need to alter the width (measure), indent and set a value for a vm - all are being correctly calculated in the Perl module and it works perfectly in the item format version of the job.

    I think as Jonathan says we are getting very close to opening a ticket but I am not sure this is a bug just that we are trying to do things that no-one has thought of.

    I need to ask the customer for permission to submit job archives so will pursue that.

    Chris