[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

AW: AW: [Maybe spam] copying raw xml and changin

Subject: AW: AW: [Maybe spam] copying raw xml and changing values...
From: "Huditsch Roman" <Roman.Huditsch@xxxxxxxxxxxxx>
Date: Wed, 16 Feb 2005 14:40:28 +0100
maybe spam
Hi Graham,

As David said before

<?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="Trades">
		<Trades>
			<xsl:for-each select="Trade">
				<Trade>
					<TradeId>
						<xsl:value-of select="position()"/>
					</TradeId>
					<ExtTradeId>
						<xsl:value-of select="TradeId"/>
					</ExtTradeId>
				</Trade>
			</xsl:for-each>
		</Trades>
	</xsl:template>
</xsl:stylesheet>

should give you your desired results.

best wishes,
Roman

> -----Urspr|ngliche Nachricht-----
> Von: Graham Walsh [mailto:graham_walsh50@xxxxxxxxxxx]
> Gesendet: Mittwoch, 16. Februar 2005 14:03
> An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Betreff: RE:  AW: [Maybe spam]  copying raw xml and
> changing values...
>
> Hi Roman,
>
> yes, that's correct. I would like the input document to be
> copied exactly except that the TradeId and ExtTradeID have
> been updated;
>
> so;
>
> <Trades>
> 	<Trade>
> 	   <TradeId>FOO</TradeId>
>                    <ExtTradeId>300</TradeId>
> 	</Trade>
>
>                 <Trade>
>                   <TradeId>BAR</TradeId>
>                   <ExtTradeId>301</TradeId>
> 	</Trade>
> </Trades>
>
> should become....
>
>
> <Trades>
> 	<Trade>
> 	   <TradeId>300</TradeId>
>                    <ExtTradeId>1</TradeId>
> 	</Trade>
>
>                 <Trade>
>                   <TradeId>301</TradeId>
>                   <ExtTradeId>1</TradeId>
> 	</Trade>
> </Trades>
>
>
> i.e. I replace the TradeId value with the ExtTradeId value.
> In paralel I want to use a counter to put a value in
> ExtTradeId, starting at 1 and incrementing each time.
>
>
> thank you so much for these replies......I really appreciate them :)
>
>
> Graham
>
> >From: "Huditsch Roman" <Roman.Huditsch@xxxxxxxxxxxxx>
> >Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> >Subject:  AW: [Maybe spam]  copying raw xml and changing
> >values...
> >Date: Wed, 16 Feb 2005 13:43:03 +0100
> >
> >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@xxxxxxxxxxx]
> > > Gesendet: Mittwoch, 16. Februar 2005 13:29
> > > An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > Betreff: [Maybe spam]  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...
> > >
> > >
> > >
> > > 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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.