Re: [xsl] looping, moving through elements??

Subject: Re: [xsl] looping, moving through elements??
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 24 Oct 2003 11:32:22 +0100

.                     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
except that there is no such axis.

<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"

   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=""

   so key('x','') 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="">
   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="">content1.1.1.1</ve>
<ve pos="1.1.2">content1.1.2</ve>
<ve pos="">content1.1.2.1</ve>
<ve pos="">content1.1.2.2</ve>
<ve pos="1.2">content1.2</ve>
<ve pos="1.2.1">content1.2.1</ve>
<ve pos="">content1.2.1.1</ve>
<ve pos="">content1.2.1.2</ve>
<ve pos="">content1.2.1.3</ve>
<ve pos="1.2.2">content1.2.2</ve>
<ve pos="">content1.2.2.1</ve>
<ve pos="1.3">content1.3</ve>
<ve pos="1.3.1">content1.3.1</ve>
<ve pos="">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="">content2.1.1.1</ve>


(where's the list auto-documentation daemon gone when you need it:-)


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:

 XSL-List info and archive:

Current Thread