[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Numbering Grouped Child Elements

Subject: Numbering Grouped Child Elements
From: Jake Stevenson <Jake.Stevenson@xxxxxxxx>
Date: Tue, 30 Jan 2001 15:45:29 -0600
td jake
I need to be able to output numbers based on groups of child elements.  I
have an XML file similar to the following:

<Steps>
	<Data_Entry>
		<Field_Name>User</Field_Name>
		<General_Data>your user name</General_Data>
	</Data_Entry>
	<Data_Entry>
		<Field_Name>password</Field_Name>
		<General_Data>your password</General_Data>
	</Data_Entry>
	<Button_Click>
		<Button_Image>OK</Button_Image>
	</Button_Click>
	<Data_Entry>
		<Field_Name>Item Number</Field_Name>
		<Specific_Data>00023</Specific_Data>
	</Data_Entry>
</Steps>

I'm able to group the elements so that the output looks like this:

Complete the following field(s):
	User
	Password
Click OK.
Complete the following field(s):
	Item Number

I used the following XSLT to accomplish that:

<xsl:for-each select="Steps/*">
	<xsl:choose>
		<xsl:when test="name()='Data_Entry'">
			<xsl:if test="position()=1">
			<tr>
				<td><!--Number to go here--></td>
				<td colspan="2">Complete the following
fields:</td>
			</tr>
			</xsl:if>
			<tr>
				<td></td>
				<td colspan="2">
					<span
class="Field_Name"><xsl:value-of select="Field_Name"/></span>
				</td>
			</tr>
		</xsl:when>
		<xsl:when test="name()='Button_Click'">
			<tr>
				<td><!--Number to go here--></td>
				<td>Click <xsl:apply-templates
select="Button_Image"/>.</td>
			</tr>
		</xsl:when>
	</xsl:choose>
</xsl:for-each>

Now, I need to number the groups so that the output looks like this:

1.  Complete the following field(s):
	User
	Password
2.  Click OK.
3.  Complete the following field(s):
	Item Number

Is this possible using <xsl:number/>?  Or do I need to seek some other
solution?  

Thank you.

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.