I have 2 different XML
1 XML
<address>
<localityType>CityType</localityType>
<locality>CityName</locality>
</address>
2 XML
<address>
<localityType>TownType</localityType>
<locality>TownName</locality>
</address>
And I have a XSLT stylesheet
...
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td>City</td>
<td>
<xsl:variable name="loc" select="//localityType"/>
<xsl:if test="loc == 'CityType'">
<xsl:value-of select="//locality" />
</xsl:if>
</td>
</tr>
<tr>
<td>Town</td>
<td>
<xsl:variable name="loc" select="//localityType"/>
<xsl:if test="localityType != 'CityType'">
<xsl:value-of select="//locality" />
</xsl:if>
</td>
</tr>
</table>
...
And as the result I want to get for the first XML the following table
And as the result for the second XML - the following table
No comments:
Post a Comment