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

Re: Maintaining Heirarchy and using Recursion to write

Subject: Re: Maintaining Heirarchy and using Recursion to write an XSL
From: "Ahsan Hussain" <ahsan_hussain@xxxxxxxxxxxxx>
Date: Tue, 24 Jun 2003 14:11:17 -0700
ahsan hussain
Here is the XML file for which i am writing an XSL StyleSheet to convert to
HTML:

<HSContract contractCategory="2" contractName="myWebservice"
id="25_610_15006485306">

	<HSDataContainerType name="DataContainer_1" required="true">gg

		<HSInteger name="integerField_1"  />
		<HSDouble name="decimalField_1" />
		<HSDate name="dateField_1"  />

		<HSDataContainerType name="DataContainer_1_1" required="true">gg

			<HSString name="textField_1_1" required="true" />
			<HSInteger name="integerField_1_1" required="true" />

			<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>

</HSContract>

I don't know the number of <HSDataContainerType> tags i could inside one
another.  I am trying to display the output (HTML) thru my XSL like:

DataContainer_1
	integerField_1
	decimalField_1
	dateField_1
	DataContainer_1_1
		textField_1_1
		integerField_1_1
		DataContainer_1_1_1
			textField_1_1_1
			integerField_1_1_1

The XSL i wrote using a <for-each> takes care of ANY number of
<HSDataContainerType> tags nested into one another. But i can't display the
fields correspoding to each. Here is my XSL (i know if condition doesn't
work!):
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="HSDataContainerType">
	<xsl:comment>call recurseTemplate</xsl:comment>
	<xsl:comment>recurse until you see a DataContainerType</xsl:comment>
	<xsl:for-each select="//HSDataContainerType">
		<div><xsl:value-of select="@name"/></div>
		<xsl:if test="contains(child::*,HSString)">
			<xsl:for-each select="//HSString">
				<xsl:value-of select="@name"/>
			</xsl:for-each>
		</xsl:if>
	</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Any help/hint would be greatly appreciated. Thank you.
-Ahsan Hussein






 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.