This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Numbering Grouped Child Elements


I sent this to the list some time ago and received no answer.  I'm still
banging my head on this one and hope someone new may be able to help.  

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'">
			<!--If this is the first Data_Entry, place
instructions-->
			<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

I've tried using <xsl:number count="Data_Entry|Button_Click"
level="single"/>, but that gives me numbering of 1,3,4 (it counts both
Data_Entrys in the first group).

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]