472,146 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

XSLT "choose" does not overwrite the innerText of the node.

hiya,
I'm still stuck at this one ;-(

I want to overwrite the "numeric" value of my node with a lookup value.
<xslt>
<xsl:for-each select="PRODUCT-TYPE">
<xsl:choose>
<xsl:when test=".='6'">Bike</xsl:when>
<xsl:when test=".='7'">Car</xsl:when>
<xsl:when test=".='1'">Van</xsl:when>
<xsl:otherwise>UNDEFINED</xsl:otherwise>
</xsl:choose>
<xsl:copy-of select="." />
</xsl:for-each>
</xslt>

<InputXml>
<rows>
<row>
<PRODUCT-TYPE>6</PRODUCT-TYPE>
<PRODUCT-DATE>01/01/2003</PRODUCT-DATE>
</row>
</rows>
</InputXml>

The output is incorrect.
1) Yes, it recognises that the value "6", corresponds to value "Bike"
2) yes, it displays the value "Bike".

However:
1) it pre-pends the value "Bike" to the <PRODUCT-TYPE> node.
2) it does NOT overwrite the value "6" with the "Bike"

here is the output. (please note that the formatting on this page means
that a SINGLE row takes up 2 lines):
<outputXml>
<rows>
<row>Bike<PRODUCT-TYPE>6</PRODUCT-TYPE> <PRODUCT_DATE>30/03/2004</PRODUCT-
DATE>
</row>
</rows>
</outputXml>

I simply want the output to be:
<outputXml>
<rows>
<row>
<PRODUCT-TYPE>Bike</PRODUCT-TYPE>
<PRODUCT_DATE>30/03/2004</PRODUCT-DATE>
</row>
</rows>
</outputXml>

Can someone help?I'm in a desperate hurry to resolve this, and have scoured
the previous posts to see if i could find a similar scenario.

many thanks,
yogi

--
Message posted via http://www.dotnetmonster.com
Nov 12 '05 #1
1 1676
SOLVED.
thanks.
yogi

--
Message posted via http://www.dotnetmonster.com
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by chris yoker via DotNetMonster.com | last post: by
reply views Thread by guido_brasletti | last post: by
1 post views Thread by arnold | last post: by
1 post views Thread by =?Utf-8?B?TWFyayBIb2xsYW5kZXI=?= | last post: by
5 posts views Thread by Cirene | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.