RE: Numbering

Subject: RE: Numbering
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Tue, 14 Dec 1999 09:49:18 -0000
> 
> I want to number the following:
> 
> <?xml version="1.0" ?> 
> 	<PXML>
> 	<Procedures>
> 		<Procedure_telnet>First Telnet</Procedure_telnet> 
> 		<Procedure>First Procedure</Procedure> 
> 		<Procedure>Second Procedure</Procedure> 
> 		<Procedure>Third Procedure</Procedure> 
> 		<Procedure>Fourth Procedure</Procedure> 
> 		<Procedure_telnet>Second Telnet</Procedure_telnet> 
> 		<Procedure>Fifth Procedure</Procedure> 
> 		</Procedures>
> 	</PXML>
> 
> But they don't come out 1, 2, etc. It comes out 1, 1, 2, 3, 4, 2, 5.
> 

<xsl:number> with no count attribute numbers the nodes that match the
current node's name and type. To number these nodes in a single sequence,
use <xsl:number count="Procedure|Procedure_telnet"/>. Alternatively, use the
position() function instead, it's almost certainly faster. You may need to
change the xsl:apply-templates to say "select='*'" to avoid numbering the
whitespace nodes between the elements, or use xsl:strip-space
elements="Procedures"/>

BTW, I don't know what you're trying to achieve with
	<xsl:preserve-space elements=""/>
It looks like a no-op to me.

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • Numbering
    • Jon Wynacht - Mon, 13 Dec 1999 16:50:33 -0800
      • <Possible follow-ups>
      • Pawson, David - Tue, 14 Dec 1999 08:28:38 -0000
      • Kay Michael - Tue, 14 Dec 1999 09:49:18 -0000 <=