Hi Daniel,
I was mislead by the wording: "match a dynamic node, given as a parameter ",
which sounds as a good description what a higher-order xsl:function does --
with the exception that we should say "apply-templates to a dynamic node,
given as a parameter ".
Reading your post for a second time I understand what you want. One way to
achieve this is, supposing that the $tomatch parameter is defined as a
single node, is to have the following template:
<xsl:template match="node() | @*">
<xsl:choose>
<xsl:when test="generate-id() = generate-id($tomatch)">
Hallo
</xsl:when>
<xsl:otherwise>
<xsl:apply-imports/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
You have to assure this template has the highest import-precedence and that
any other templates are part of stylesheets imported by the stylesheet that
contains the above template. Not very convenient, but possible to do.
In XSLT 2.0 one can use the <xsl:next-matchinstruction -- designed to
eliminate the inconvenience of using <xsl:apply-importsin a case like
this -- the overridden templates that are invoked can now be in the same
stylesheet.
Hope this helped.
Cheers,
Dimitre Novatchev
"Daniel Frey" <qw*******@gmx.chwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Thanks for the hint Dimitre. How would FXSL help me doing that?
Daniel
Dimitre Novatchev schrieb:
>Search for FXSL
Cheers,
Dimitre Novatchev
"Daniel Frey" <qw*******@gmx.chwrote in message
news:11**********************@p79g2000cwp.googleg roups.com...
Hello
I'd like to match a dynamic node, given as a parameter to the
stylesheet. Something like:
<xsl:stylesheet ...>
<xsl:param name="tomatch"/>
<xsl:template match="{$tomatch}">
Hallo
</xsl:template>
</xsl:stylesheet>
However, this seems not to be so simple, as "{" and if I remove the
parentesis the "$" are not allowed in the match value.
Certainly, I could take this as a row xslt and pre-transform it with
another script to merge the value of the variable into the {$tomatch}
location. However, then I would need two steps, one to create the
merged xslt, and another to transform the xml with it.
Is there a way to get it simlier? Any idea how to match dynamic nodes
given in parameters would be highly appreciated.
Thanks in advance.
Daniel Frey