Subject: Re: [xsl] xml->xsl using xslt From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Mon, 11 Feb 2008 17:07:42 +0000 |
On 11/02/2008, Rose Rose <rose2577@xxxxxxxxx> wrote: > Hi all: > > Is it possible to write an xslt to convert one xml > document to another by renaming the elements? > eg: if i have soemthing like this: > > <text1> > <sample>data</sample> > </text1> > > and I want to transform it to: > > <text2> > > <sample1>data</sample1> > </text2> > > Can I do something like this in xslt? use the "identity" template with a specific template for your requirements: <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="text1"> <text2> <sample1><xsl:value-of select="."/></sample1> </text2> </xsl:template> cheers -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xml->xsl using xslt, Spencer Tickner | Thread | [xsl] Merge two xml files into one , Kerry, Richard |
[xsl] Merge two xml files into one , Kerry, Richard | Date | RE: [xsl] Merge two xml files into , Michael Kay |
Month |