Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Dumb Question - XML to XML changing only a few values

From: "Andrew Welch" <andrew.j.welch@--------->
To:
Date: 12/3/2007 9:56:00 AM
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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent