I also posted at Adepter's, and Clay Helberg replied with a very useful text.
"Hi Greg—
I don’t have time to test this now, but I would think you could do something like this using an XPath condition, along these lines:
Sheet/Title->
If (count(ancestor::figure/sheet)>1):
Gentext After: (Sheet {xpath-string(count(preceding-sibling::sheet)+1)} of {xpath-string(count(ancestor::figure/sheet))})
I hope you can interpret my pseudo-Styler code here.
--Clay"
I took this example and this is how I worked with it in Styler, my reply to Clay:
Hi Clay,
Ok! Using your coding I managed to implement it within Styler. It has to be divided though.
What I did was select the element graphic everywhere and I inserted a condition, chose type If, and clicked on the New Xpath Test… button. I entered:
(count(ancestor::figure/graphic)>1)
Then with the condition selected I chose the Category: Generated text and clicked on the Edit Button next to Add before element content: At this point it gets a bit funny to edit, because you cannot simply paste in text, there are additional steps;
Type “Sheet ” then from the Insert menu choose Xpath String… at that point when the dialog box comes up you can insert the xpath string in the XPath Expression: field
count(preceding-sibling::graphic)+1
I then clicked on ok, typed “ of “ and repeated the process for the following:
count(ancestor::figure/graphic)
Note - I found I can edit the xpath string by selecting it and choosing modify attributes from the right click context menu
After editing this is complete, choose from the File menu Apply and Close.
I copied the code from the Add before element content: field so you can see it:
Sheet•<_gte:XPathString expr="count(preceding-sibling::graphic)+1"/>•of•<_gte:XPathString expr="count(ancestor::figure/graphic)"/>
And, it works! Woot! Now only the figures with multiple graphics show "Sheet 1 of 7" for example.
Many thanks for your help Clay!
Greg
🙂