Subject: [xsl] Count previous-siblings w/same attribute value up to attribute value - 1 possible? From: "Lou Argyres" <Lou.Argyres@xxxxxxxxxxxx> Date: Mon, 12 Dec 2011 16:54:28 -0800 |
I hope this makes sense. I have "flat" outline list structures, the numbering of which is controlled by a "level" attribute, that I renumber based on name-spaced change tracking tags where I need to output Accept-All and Reject-All versions to be redlined in other application formats after transformations. (They're good for unsophisticated users who have trouble editing embedded lists.) The best I've come up with is a recursive template to count previous same level items and stop at a lower level (skipping adds/deletes as needed). Is there an XPATH-2 select that can count preceding-siblings up to the first preceding @level = $lvl-1? <xsl:variable name="lvl" select="@level"/> ... ... select="(count(preceding-sibling::section[@level=$lvl]) + 1) - count(preceding-sibling::section[@level=$lvl][not(following-sibling::sec tion[preceding-sibling::section[@level=number($lvl)-1][1]])])" picks up all previous same-level items. <flatOutline> <item numDisplay="I." level="1" /> <item numDisplay="II." level="1" /> <item numDisplay="A." level="2" /> <item numDisplay="B." level="2" /> <item numDisplay="C." level="2" /> <item numDisplay="III." level="1"/> <item numDisplay="A." level="2"/> <item numDisplay="1." level="3" /> <item numDisplay="2." level="3" /> <item numDisplay="3." level="3" /> <item numDisplay="4." level="3" /> <item numDisplay="B." level="2"/> <item numDisplay="1." level="3" /> <item numDisplay="2." level="3" /> <item numDisplay="3." level="3" /> <item numDisplay="C." level="2"/> </flatOutline> Lou Argyres Continuing Education of the Bar - California Oakland, CA Lou.Argyres@xxxxxxxxxxxx
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Performance improvement f, Manfred Staudinger | Thread | Re: [xsl] Count previous-siblings w, Liam R E Quin |
[xsl] Performance improvement for a, Manfred Staudinger | Date | Re: [xsl] Count previous-siblings w, Liam R E Quin |
Month |