xsl-list
[Top] [All Lists]

RE: Count preceeding sibling but in different element

2005-08-05 01:00:07

I am wanting to count all preceeding sibling (steps) but they could be
in different elements

In that case they are cousins, not siblings. Two elements are siblings only
if they share the same parent.
 
<element1>
  <element2>
     <step/>
     <step/>
  </element2>
  <element3>
     <step/>
  </element3>
  <element4>
     <step/>
     <step/>
     <step/>
  </element4>
</element1>
 
The output I am after is

<element1>
  <element2>
     <step number="1" />
     <step number="2"/>
  </element2>
  <element3>
     <step number="3"/>
  </element3>
  <element4>
     <step number="4"/>
     <step number="5"/>
     <step number="6"/>
  </element4>
</element1>

  
Use <xsl:number level="any" from="element1"/>

Michael Kay
http://www.saxonica.com/



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--