Subject: Re: [xsl] looping, moving through elements?? From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 24 Oct 2003 11:32:22 +0100 |
".|following-sibling::ve" . selects the current node following-sibling::ve selects the following ve nodes. | is the union of these selections. as the current node is a ve this is just following-sibling-or-self::ve except that there is no such axis. <vss> <ve pos="1">content1</ve> <ve pos="1.1">content1.1</ve> ^^^ so if you are here then .|follwing-sibling::ve selects this node and all the ve nodes below. This node will be indexed by teh key as it matches match="ve" <xsl:key name="x" match="ve" use="(.|folowing-sibling::ve) [string-length(@pos)=3+string-length(translate(@pos,'.',''))][1]/@pos"/> and its key will be the value of the use expression which is (once you spell check folowing:-) the pos attribute (/@pos) of the first ([1]) ve element thathas three "." ([string-length(@pos)=3+string-length(translate(@pos,'.',''))]) so that is pos="1.1.1.1" so key('x','1.1.1.1') would retrun this node and any other nodes with the same key, which is <ve pos="1"><ve pos="1.1"><ve pos="1.1.1"><ve pos="1.1.1.1"> so all you have to do is loop through all the 3-dot ones, making a row for each, then look up in the key and that will return all the nodes to go in that row, hence the inner for-each. <ve pos="1.1.1">content1.1.1</ve> <ve pos="1.1.1.1">content1.1.1.1</ve> <ve pos="1.1.2">content1.1.2</ve> <ve pos="1.1.2.1">content1.1.2.1</ve> <ve pos="1.1.2.2">content1.1.2.2</ve> <ve pos="1.2">content1.2</ve> <ve pos="1.2.1">content1.2.1</ve> <ve pos="1.2.1.1">content1.2.1.1</ve> <ve pos="1.2.1.2">content1.2.1.2</ve> <ve pos="1.2.1.3">content1.2.1.3</ve> <ve pos="1.2.2">content1.2.2</ve> <ve pos="1.2.2.1">content1.2.2.1</ve> <ve pos="1.3">content1.3</ve> <ve pos="1.3.1">content1.3.1</ve> <ve pos="1.3.1.1">content1.3.1.1</ve> <ve pos="2">content2</ve> <ve pos="2.1">content2.1</ve> <ve pos="2.1.1">content2.1.1</ve> <ve pos="2.1.1.1">content2.1.1.1</ve> </vss> David (where's the list auto-documentation daemon gone when you need it:-) -- http://www.dcarlisle.demon.co.uk/matthew ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] looping, moving through e, james walker | Thread | Re: [xsl] looping, moving through e, james walker |
Re: [xsl] formatting text with nest, David Carlisle | Date | Re: [xsl] formatting text with nest, M. David Peterson |
Month |