Subject: Re: [xsl] Dumb Question - XML to XML changing only a few values From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Fri, 30 Nov 2007 17:28:58 -0500 |
Is there a way to say "just copy everything to the destination XML, but any instance of <a></a> will have its contents replaced"?
<xsl:template match="@*|node()"><!--identity for all other nodes--> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template>
For example
Source XML
...
So I just want to say replace contents of <a></a> with 12345 and just copy everything else
Destination XML ...
T:\ftemp>type mark.xml <test> <a>A</a> <b>B</b> <c>C</c> <d>D</d> <e>E</e> <f>F</f> <g>G</g> </test> T:\ftemp>type mark.xsl <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="a"> <xsl:copy>12345</xsl:copy> </xsl:template>
<xsl:template match="@*|node()"><!--identity for all other nodes--> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template>
</xsl:stylesheet> T:\ftemp>xslt mark.xml mark.xsl con <?xml version="1.0" encoding="utf-8"?><test> <a>12345</a> <b>B</b> <c>C</c> <d>D</d> <e>E</e> <f>F</f> <g>G</g> </test> T:\ftemp>
-- Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008 World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Dumb Question - XML to XML ch, Mark Anderson | Thread | [xsl] CDATA and Named Entities to A, Mark Anderson |
RE: [xsl] Help with tree menu, Lucas Gonçalves Gros | Date | [xsl] CDATA and Named Entities to A, Mark Anderson |
Month |