Subject: RE: [xsl] need a variable path in the template-match attribut From: "Andrew Welch" <awelch@xxxxxxxxxxxxxxx> Date: Tue, 26 Nov 2002 14:07:44 -0000 |
> I need an XSLT which copies all nodes to a new XML, but one > tag needs to be > changed. This should be done with a variable because I want > to use it in > Apache Cocoon and want to call the stylesheet with a > parameter like this: You need to use a choose/when in your indentity transform: <xsl:template match="@*|node()"> <xsl:choose> <xsl:when test="local-name() = $param"> <myelement> <xsl:apply-templates select="@*|node()"/> </myelement> </xsl:when> <xsl:otherwise> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:otherwise> </xsl:choose> </xsl:template> cheers andrew > -----Original Message----- > From: inchi2000@xxxxxx [mailto:inchi2000@xxxxxx] > Sent: 26 November 2002 13:48 > To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] need a variable path in the template-match attribut > > > Hello! > > I need an XSLT which copies all nodes to a new XML, but one > tag needs to be > changed. This should be done with a variable because I want > to use it in > Apache Cocoon and want to call the stylesheet with a > parameter like this: > http://localhost:8080/cocoon/edit?mypath=//ad/new > > <xsl:param name="mypath"/> > <xsl:template match="@*|node()"> > <xsl:copy> > <xsl:apply-templates select="@*|node()"/> > </xsl:copy> > </xsl:template> > <xsl:template match="$mypath"> > <xsl:copy>New Text Here</xsl:copy> > </xsl:template> > > I know that I can't use variable-references in the match attribut in > templates. But I think this should be possible in some way ;) > Thanks for your help! > Markus Karsch > > -- > +++ GMX - Mail, Messaging & more http://www.gmx.net +++ > NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen! > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] need a variable path in t, bryan | Thread | [xsl] parameters in xsp don't work, Robert Sösemann |
[xsl] need a variable path in the t, inchi2000 | Date | RE: [xsl] need a variable path in t, bryan |
Month |