Hello Experts,
I'm trying to convert an dynamic XML doc into HTML using XSLT.
In the example I have shown one form(form1)...But there could be multiple forms....names are unknown and each one could have o or more childforms .I want to display form1 as <th> element followed by attributes,then display Childform1 as header(if there is a child form) .See the XSl below.
Is there a way to check if form1 has childforms...so i could render them differently than children of form1.
Pls help.
<root>
<forms>
<form1 attr1= "p" attr2 = "q">
<childForm1>
<SOURCE_CD>17</SOURCE_CD>
<MAIN_FORM_ID>00023</MAIN_FORM_ID>
<DISTRICT_CD>00</DISTRICT_CD>
</childForm1>
<childForm2>
<SOURCE_CD>17</SOURCE_CD>
<MAIN_FORM_ID>00023</MAIN_FORM_ID>
<DISTRICT_CD>00</DISTRICT_CD>
</childForm2>
<childForm3>
<SOURCE_CD>17</SOURCE_CD>
<MAIN_FORM_ID>00023</MAIN_FORM_ID>
<DISTRICT_CD>00</DISTRICT_CD>
</childForm3>
<childForm4>
<SOURCE_CD>17</SOURCE_CD>
<MAIN_FORM_ID>00023</MAIN_FORM_ID>
<DISTRICT_CD>00</DISTRICT_CD>
</childForm4>
<INT_DCMT_ID>242563</INT_DCMT_ID>
<EXT_TP_ID>214201050</EXT_TP_ID>
<TAX_TYPE_CD>PI</TAX_TYPE_CD>
<TAX_SUB_TYPE_CD>01</TAX_SUB_TYPE_CD>
</form1>
</forms>
</root>
<xsl:template name="label-value">
<tr><th><xsl:value-of select="name()" /></th></tr>
<xsl:for-each select="@*">
<tr>
<td>@ <xsl:value-of select="name()" /></td>
<td><xsl:value-of select="." /></td>
</tr>
</xsl:for-each>
<xsl:for-each select="*">
<tr>
<td><xsl:value-of select="name()" /></td>
<td><xsl:value-of select="." /></td>
</tr>
</xsl:for-each>
</xsl:template>
<xsl:template match="forms">
<xsl:for-each select="*">
<xsl:call-template name="label-value" />
</xsl:for-each>
</xsl:template>