C
chris yoker
Hiya,
I need to convert the actual markup in this XML, so that I can databind.
I need to convert it:
FROM:
<rows>
<row>
<FIELD NAME="PRODUCT-TYPE">CAR</FIELD>
<FIELD NAME="PRODUCT-DATE">01/01/2004</FIELD
</row>
<row>
<FIELD NAME="PRODUCT-TYPE">BIKE</FIELD>
<FIELD NAME="PRODUCT-DATE">01/01/2003</FIELD
</row>
</rows>
TO:
<rows>
<row>
<PRODUCT-TYPE>CAR</PRODUCT-TYPE>
<PRODUCT-DATE>01/01/2004</PRODUCT-DATE>
</row>
<row>
<PRODUCT-TYPE>BIKE</PRODUCT-TYPE>
<PRODUCT-DATE>01/01/2003</PRODUCT-DATE>
</row>
</rows>
I’m trying with the following XSLT, but obviously, it isn’t giving me
what I want :-(
Can anyone give me a push in the right direction?
Many thanks,
yogi
<xsl:template match="*">
<xsl:when test="@NAME='PRODUCT-TYPE'">
<xsl:for-each select="FIELD">
<xsl:choose>
<xsl:when test="@NAME='PRODUCT-TYPE'">
<PRODUCT-TYPE>
<xsl:value-of select="." />
</PRODUCT-TYPE>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:when>
</xsl:template>
I need to convert the actual markup in this XML, so that I can databind.
I need to convert it:
FROM:
<rows>
<row>
<FIELD NAME="PRODUCT-TYPE">CAR</FIELD>
<FIELD NAME="PRODUCT-DATE">01/01/2004</FIELD
</row>
<row>
<FIELD NAME="PRODUCT-TYPE">BIKE</FIELD>
<FIELD NAME="PRODUCT-DATE">01/01/2003</FIELD
</row>
</rows>
TO:
<rows>
<row>
<PRODUCT-TYPE>CAR</PRODUCT-TYPE>
<PRODUCT-DATE>01/01/2004</PRODUCT-DATE>
</row>
<row>
<PRODUCT-TYPE>BIKE</PRODUCT-TYPE>
<PRODUCT-DATE>01/01/2003</PRODUCT-DATE>
</row>
</rows>
I’m trying with the following XSLT, but obviously, it isn’t giving me
what I want :-(
Can anyone give me a push in the right direction?
Many thanks,
yogi
<xsl:template match="*">
<xsl:when test="@NAME='PRODUCT-TYPE'">
<xsl:for-each select="FIELD">
<xsl:choose>
<xsl:when test="@NAME='PRODUCT-TYPE'">
<PRODUCT-TYPE>
<xsl:value-of select="." />
</PRODUCT-TYPE>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:when>
</xsl:template>