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

Re: Dumb Question - XML to XML changing only a few val

Subject: Re: Dumb Question - XML to XML changing only a few values
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Mon, 3 Dec 2007 09:55:13 +0000
Re:  Dumb Question - XML to XML changing only a few val
On 01/12/2007, Mukul Gandhi <gandhi.mukul@xxxxxxxxx> wrote:
> On 12/1/07, G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote:
> > <xsl:template match="a">
> >   <xsl:copy>12345</xsl:copy>
> > </xsl:template>
>
> Somehow, I would have preferred ...
>
> <xsl:template match="a">
>   <xsl:copy>
>     <xsl:text>12345</xsl:text>
>   </xsl:copy>
> </xsl:template>
>
> But Ken's choice taught me something new :)

Your choice would be the neater option if <a> had any attributes that
you needed copied, eg:

<xsl:template match="a">
 <xsl:copy>
   <xsl:copy-of select="@*"/>
   <xsl:text>12345</xsl:text>
 </xsl:copy>
</xsl:template>

or possible more future proof in case you ever need to override the copy:

<xsl:template match="a">
 <xsl:copy>
   <xsl:apply-templates select="@*"/>
   <xsl:text>12345</xsl:text>
 </xsl:copy>
</xsl:template>




cheers
-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

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.