I need to create a xpath-expression in Styler that finds at the latest section element with a specific value on it´s type attribute. The section element can be nestled so I cant predict where the type attribute was set the last time. I need to do this so that I know what derived section type I have.
Example of context:
In all the above I need to know the latest section where type was set.
My thought was to create the following condition (and repeat it for other type values):
Unfortunatly it doesn´t seem to do the trick and I have spoken to others working with Styler that says it is hard to create working reverse expressions in Styler.
Has anyone had any experience of this or perhaps even a solution?
Greatful for all answers!
Not sure I fully understand your request, but did you try parent::section[@type='xx'][position()=last()]?
If you provide example, I could try to give a more precise answer.
That is a good idea but I dont seem to get the expected response from Styler. I must say that it seems as if the parent axes command dont work properly. Do you have experience using parent calls in Styler?
I will try to create a better example.
I have three different page layouts that is used (lets call them lay1, lay2 och lay3). These page layouts can be set for each section using the type attribute (the type attribute will list lay1, lay2 and lay3).
If I specifiy a type attribute on a section, nestled sections will derive the same page layout unless the type attribute is set for nestled sections as well.
The first section will use lay1, nestled sections will also use lay1.
The first section will use lay1, so will the first nestled section. After that there will be two nestled sections using lay2.
It becomes more complicated when you add elements in the last section that needs to be formatted in other ways depending on the derived section type.
In this case I want to change the indent for the table depending on the derived section type (lay2).
Since I have problems using parent I believe I need to find another way. If I use ancestor it will point to the first section giving me lay1.
Currently im working with a lot of variants of "../../@type='lay2'" to get where I want but I am certain that it isn't the best way.
So basically what I am looking for is a xpath-command that will navigate from current context to the first section where the attribute type has been set.
That is exactly what i'm looking for! Thanks for making my day!
This is by far the best forum reply I have ever recieved!