cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Counting Graphics and Sheets of a Figure in Styler

GregoryMackenzi
1-Newbie

Counting Graphics and Sheets of a Figure in Styler

This is such an obvious topic I was surprised by the lack of information in the Styler manual, help files and on-line. It seems like a really obvious topic to me, but I could only find a single reference to counting the sheets and/or graphics of a figure in the Arbortext help file documentation. "Counting Sheets of a Figure in Styler" which is basically a FOSI topic, and "Coding FOSI support for sheet count".

Is there an equivalent topic showing how counting sheets and/or graphics can be done within Styler itself?

Ideally, the styling should be able to recognize when there are multiple graphics/sheets in a figure and output the Figure number, title, followed by (Sheet 1 of n), thus if there are multiple sheets/graphics in a figure it should output something like "Figure 1. Name of Figure (Sheet 1 of 5)".


4 REPLIES 4

Hi Clay,

Thanks for the response! I think your on the right track, particularly with the part of the statement that evaluates the number of repeated nodes. I've been digging I came across a couple of articles at support.ptc.com, TPI 140544 and CS185369 which are almost related to this topic.

I borrowed some of the code there and modified it into the following which in Styler I placed into the Add before element content: field of graphic everywhere:

[cid:image001.png@01CFDEF9.952B9C80]

This is the full code I used:

Sheet*<_gte:XPathString expr="count(preceding-sibling::graphic)+1"/>*of*<_gte:XPathString expr="count(ancestor::figure/graphic)"/>

I get "Sheet 1 of 7" for this and "Sheet 1 of 1" which I don't really want but hey, any progress is progress!

I was just fishing at the W3C for an xpath IF statement, so your message is very timely, 🙂 I'll give your coding a try!

Many thanks,

Greg
🙂

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)

It looks like this:

[cid:image002.png@01CFDEFE.5F1FC210]

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. The expression then looks like this:

[cid:image003.png@01CFDEFE.5F1FC210]

I copied the code from the 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!

Many thanks for your help Clay!

Greg
🙂

Great, I'm glad you were able to (eventually) decipher my funny Styler shorthand. What you ended up doing is pretty much what I intended, with the XPath strings and such--I just didn't have time this morning to spell out the exact steps all the way through. Glad you got it sorted out.

--C

Sent from my iPad

On Oct 3, 2014, at 9:37 AM, "Greg MacKenzie" <-<<a style="COLOR:" blue;=" text-decoration:=" underline&quot;=" target="_BLANK" href="mailto:-">>">mailto:->> wrote:

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)

It looks like this:

<image002.png>

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. The expression then looks like this:

<image003.png>

I copied the code from the 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!

Many thanks for your help Clay!

Greg
Smiley Happy

Hi Clay,

Thanks very much for the help, :). Yeah, I was able to work out how to get that into Styler from your notes, hence the step-by-step follow up. This group has always been the most helpful!

Thanks again!

Greg
🙂
Top Tags