[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Count previous-siblings w/same attribute value up to
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|