Subject: Re: [xsl] Template match via xsl:param From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Tue, 15 Jan 2002 09:57:40 +0000 |
Hi Mario, > So, here is what I am trying to do: > > <?xml version="1.0"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> > <xsl:output method="html" indent="yes" > encoding="iso8859-15"/> > <xsl:param name="path"></xsl:param> > <xsl:include href="identity.xsl"/> > > <xsl:template match="$path"/> > > </xsl:stylesheet> > > Can anyone give me a simple example on how to achieve this without > genereting the xsl file on the fly? You can't, I'm afraid. If the $path parameter only specifies an element name, then what you could do is change the xsl:include to an xsl:import, and have the following template, which matches all elements, and goes on to process them with whatever's supplied in identity.xsl unless their name is the same as the $path parameter: <xsl:template match="*"> <xsl:if test="name() != $path"> <xsl:apply-imports /> </xsl:if> </xsl:template> If the $path is a more complex path, you could extend this solution to do more elaborate checks on the identity of the element (rather than just looking at its name) before going on to process it (or not). Because of predicates, trying to implement a path pattern matcher in XSLT is just as hard as trying to implement an XPath evaluator in XSLT. But then probably the patterns that you're actually using are a subset of the patterns that would be allowed in the match attribute, so you might be able to make it work. Otherwise, as you say, you need to generate the XSLT stylesheet on the fly. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Template match via xsl:param, Mario Lang | Thread | [xsl] XSLT match with regex what's , Gunther Schadow |
Re: [xsl] Singling Out Nodes in Loo, Jeni Tennison | Date | Re: [xsl] how to select nodes betwe, Jeni Tennison |
Month |