By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,991 Members | 1,737 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,991 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.