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

RE: Changing a node value for a variable

Subject: RE: Changing a node value for a variable
From: Jarno.Elovirta@xxxxxxxxx
Date: Tue, 26 Nov 2002 16:40:59 +0200
xsl changing a nodes value
Hi,

> Since a variable may contain a node set, is it possible to 
> modify the value
> of one node in the variables nodes.

No, but you can make a copy of the node-set bound to the variable and changed it when copying.

> Example:
> <foo>
>   <data1>Tom</data1>
>   <data2>Jones</data2>
> </foo>
> 
> to
> 
> <foo>
>   <data1>Bridget</data1>
>   <data2>Jones</data2>
> </foo>

make a identity transformation, where you have

<xsl:template match="data1/text()[. = 'Tom']">Bridget</xsl:template>

> or is it possible to add a new child node?
> 
> Example:
> <foo>
>   <data1>Tom</data1>
>   <data2>Jones</data2>
> </foo>
> 
> to
> 
> <foo>
>   <data1>Tom</data1>
>   <data2>Jones</data2>
>   <data3>Bridget</data3>
> </foo>

again, write an identity transformation with

<xsl:template match="foo">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()" />
    <data3>Bridget</data3>    
  </xsl:copy>
</xsl:template>

Cheers,

Jarno - Apoptygma Berzerk: Nearer

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.