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