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

Re: Recursing in XSLT

Subject: Re: Recursing in XSLT
From: "Ahsan" <ahsan_hussain@xxxxxxxxxxxxx>
Date: Mon, 23 Jun 2003 18:10:22 -0700
recursing in xsl
Hello All-

I am converting the XML attached below to HTML using XSL Style Sheet. We
could have unlimited number of <HSDataContainerType> tags with other
<HSString> or <HSInteger> etc. tags inside those. I don't know how to
recursively go thru. all tags when i don't know the number of
<HSDataContainerType> tags inside one another. Any help or hint would be
greatly appreciated.



XML:
	<HSDataContainerType list="true" name="Inputs" required="true"
systype="true">
		<HSString name="textField_1" required="true" xmlNodeType="1" />
		<HSInteger name="integerField_1" required="true" xmlNodeType="1" />
		<HSDouble name="decimalField_1" required="true" xmlNodeType="1" />
		<HSDate name="dateField_1" required="true" xmlNodeType="1" />
		<HSBinary name="binaryField_1" required="true" xmlNodeType="1" />
		<HSBoolean name="trueFalseField_1" required="true" xmlNodeType="1">
			<DefaultValue>false</DefaultValue>
		</HSBoolean>
		<HSDataContainerType name="DataContainer_1_1" required="true" revision="">
			<HSString name="textField_1_1" required="true" xmlNodeType="1" />
			<HSInteger name="integerField_1_1" required="true" xmlNodeType="1" />
			<HSDataContainerType name="DataContainer_1_1_1" required="true">
				<HSString name="textField_1_1_1" required="true" />
				<HSInteger name="integerField_1_1_1" required="true" />
			</HSDataContainerType>
		</HSDataContainerType>
	</HSDataContainerType>

XSL (use to tackle only a set number of <HSDataContainerType> tags, 1 in
this case):

<xsl:template match="HSDataContainerType">

	<xsl:if test="contains(@name, 'Inputs')">

		<b><p><xsl:value-of select="@name"/>:</p></b>

		<xsl:comment>loop thru all elements in 'Inputs'</xsl:comment>

		<xsl:for-each select="./HSString">
			<xsl:value-of select="@name"/>;
		</xsl:for-each>

		<xsl:for-each select="./HSDouble">
			<xsl:value-of select="@name"/>;
		</xsl:for-each>

		<xsl:for-each select="./HSBoolean">
			<xsl:value-of select="@name"/>;
		</xsl:for-each>

		<xsl:for-each select="./HSBinary">
			<xsl:value-of select="@name"/>;
		</xsl:for-each>

		<xsl:for-each select="./HSInteger">
			<xsl:value-of select="@name"/>;
		</xsl:for-each>

		<xsl:for-each select="./HSDate">
			<xsl:value-of select="@name"/>;
		</xsl:for-each>

</xsl:if> <!-- inputs ends here -->



 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.