Hi Graham,
Could you give an example of how you would expect your outcome to look like?
Should it be:
<Trades>
<Trade>
<TradeId>1</TradeId>
<ExtTradeId>FOO</TradeId>
</Trade>
<Trade>
<TradeId>2</TradeId>
<ExtTradeId>FOO</TradeId>
</Trade>
<Trade>
<TradeId>3</TradeId>
<ExtTradeId>FOO</TradeId>
</Trade>
</Trades>
wbr,
Roman
-----Ursprüngliche Nachricht-----
Von: Graham Walsh [mailto:graham_walsh50(_at_)hotmail(_dot_)com]
Gesendet: Mittwoch, 16. Februar 2005 13:29
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: [Maybe spam] [xsl] copying raw xml and changing values...
Hi,
I can't seem to get this right... it's buggin me as I'm very
new to xsl and I'm under pressure here :(
I've got XML that looks something like this...
<Trades>
<Trade>
<TradeId>FOO</TradeId>
<ExtTradeId>300</TradeId>
</Trade>
<Trade>
<TradeId>FOO</TradeId>
<ExtTradeId>301</TradeId>
</Trade>
<Trade>
<TradeId>FOO</TradeId>
<ExtTradeId>302</TradeId>
</Trade>
</Trades>
I want to iterate over all the "Trade" elements and replace
the ExtTradeId attribute with the value contained in the
TradeId field. In addition I want to use a counter to replace
the TradeId with the value of counter , and increment the
counter each time.
I can't for the life of me see how to do this. My output is
raw XML so I'm using xsl:copy and xsl:for-each but am making
a hames of it altogether.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xsl:for-each select="Trade">
<xsl:value-of select="TradeId"/>
</xsl:for-each>
</xsl:copy>
</xsl:template>
Can anybody give me some pointers. I think a script might be
better in this
case but I'm on the xsl track so I might as well stay on it.
thanks MILLIONS to anybody that can provide help... my boss
is givin' me
grief over this.... how to be an XSL expert in 12 hours! :( :(
G
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--