<index><title></title><tgroup></tgroup>
<sys>
<title></title> <-- The first title in every <sys> does not get included in numbering
<title></title>
<part>
<item><label></label><para></para></item>
<location></location></part>
<part>
<item><label></label><para></para></item>
<location></location></part>
<part>
<item><label></label><para></para></item>
<location></location></part>
<part>
<item><label></label><para></para></item>
<location></location></part>
<part>
<item><label></label><para></para></item>
<location></location></part>
<title></title>
<part>
<item><label></label><para></para></item>
<location></location></part>
<part>
<item><label></label><para></para></item>
<location></location></part>
</sys>
<sys>
<title></title> <-- The first title in <sys> does not get included in numbering
<title></title>
<part>
<item><label></label><para></para></item>
<location></location></part>
<title></title>
<part>
<item><label></label><para></para></item>
<location></location></part>
<part>
<item><label></label><para></para></item>
<location></location></part>
<title></title>
<part>
<item><label></label><para></para></item>
<location></location></part>
<part>
<item><label></label><para></para></item>
<location></location></part>
</sys>
</index>
I want to number the titles in <sys>, excluding the first title. There are multiple <sys> tags and multiple <titles> within <sys>.
I would have thought I could do this myself, but all I'm getting is "0". Thanks!
Thank you, Venkata, but that is still giving me a "0"
Sure Brandon, this is for Styler 5.4. I am not sure I need to use XPATH, it seemed the easiest way to go. I want the titles numbered in <sys>, ignoring the first title, and I want them to restart for each <sys>
I made <sys> a formal block and created two contexts, first title in <sys> and not first title in <sys> and added the gentext title number to not first title. I don't think the logic is correct. Without using XPATH, the titles in the first <sys> are all numbered 1. In the second <sys>, title numbering starts at 2 and increments to 7 so that the third <sys> starts at 8. They should all start at 1.
Then I tried putting XPATH expressions in notfirst title context in <sys>. I have tried: count(title)+1 which just returned 1 for all titles.
count(preceding::sys[title])+1, count(../preceding-sibling::sys[title])+1, count(../preceding-sibling::*[title])+1, count(../preceding-sibling::title)+1 incremented for each <sys> but each title was numbered the same, i.e. all the titles in the first <sys> were numbered 1, all the titles in the second <sys> were numbered 2, etc.
This is what it should look like for two <sys>:
<sys>
Title (This is the first title in <sys>)
1. Title 2:
a. text
b. text
c. text
d. text
2. TItle 3
a. text
b. text
3. Title 4
a. text
b. text
c. text
</sys>
<sys>
Title
1. Title 2:
a. text
b. text
c. text
2. TItle 3
a. text
b. text
c. text
3. Title 4
a. text
b. text
c. text
d. text
</sys>
In Reply to Brandon Ibach:
I think a little more context would help. This is for numbering in Styler?
If so, are you sure you need to use XPath to get what you want? I suspect
Styler can do it without an XPath expression (even if it will compile it to
an XPath expression for certain outputs, anyway). Where are you trying to
put the XPath in (what element/context, which field/dialog, etc.) and what
XPath expressions have you tried, there?
If it's not for Styler, then what is the context?
Also, just for clarity, can you indicate what the desired result would be
for each case in your example?
-Brandon 🙂
On Tue, May 15, 2012 at 12:34 AM, Caroline Leccese <
@caroline@thecodesource.net> wrote:
> <index><title></title><tgroup></tgroup>
>
> <sys>
> <title></title> <-- The
> first title in every <sys> does not get included in numbering
> *<title></title>*
> <part>
> <item><label></label><para></para></item>
> <location></location></part>
> <part>
> <item><label></label><para></para></item>
> <location></location></part>
> <part>
> <item><label></label><para></para></item>
> <location></location></part>
> <part>
> <item><label></label><para></para></item>
> <location></location></part>
> <part>
> <item><label></label><para></para></item>
> <location></location></part>
> *<title></title>*
> <part>
> <item><label></label><para></para></item>
> <location></location></part>
> <part>
> <item><label></label><para></para></item>
> <location></location></part>
> </sys>
>
> <sys>
> <title></title> <-- The
> first title in <sys> does not get included in numbering
> *<title></title>*
> <part>
> <item><label></label><para></para></item>
> <location></location></part>
> *<title></title>*
> <part>
> <item><label></label><para></para></item>
> <location></location></part>
> <part>
> <item><label></label><para></para></item>
> <location></location></part>*
> <title></title>*
> <part>
> <item><label></label><para></para></item>
> <location></location></part>
> <part>
> <item><label></label><para></para></item>
> <location></location></part>
> </sys>
>
> </index>
>
> I want to number the titles in <sys>, excluding the first title. There are
> multiple <sys> tags and multiple <titles> within <sys>.
>
> I would have thought I could do this myself, but all I'm getting is "0".
> Thanks!
>
Thanks Brandon! That worked.