all groups > dotnet xml > december 2003 >
You're in the

dotnet xml

group:

Paramaters in <xsl:template match>


Paramaters in <xsl:template match> dwa
12/7/2003 8:44:09 AM
dotnet xml:
Is it legal to use a parameter in a <template match> ?

If I do the following:

<xsl:template
match="/ContentRoot/Content/Categories/Category[@name='Studies']">

....everything works as expected. But if I do the following:

<xsl:template
match="/ContentRoot/Content/Categories/Category[@name='$category']">

I get the entire XML file dumped into the output stream! (Very strange)

I've verified that $category is indeed resolving to the value 'Studies', yet
these two statements behave very differently.

Anyone know why this happens?

-- dwa



Re: Paramaters in <xsl:template match> Dimitre Novatchev
12/7/2003 3:49:30 PM

[quoted text, click to view]

In XSLT 1.0 this is not allowed in order to avoid (at least partially)
circular definitions (the xsl:param could have in its body a reference
(xsl:apply-templates) to the same template that references this xsl:param).



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

Re: Paramaters in <xsl:template match> Oleg Tkachenko
12/7/2003 3:54:37 PM
[quoted text, click to view]

Not in XSLT 1.0.

--
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog
Re: Paramaters in <xsl:template match> dwa
12/8/2003 5:51:42 PM
Thanks.

This being the case, I've solved the problem by specifying
a shallower path in my <template match> and using the
parameter names within my <for> loop instead.

-- dwa




[quoted text, click to view]
Re: Paramaters in <xsl:template match> dwa
12/8/2003 5:52:10 PM
Thanks.

This being the case, I've solved the problem by specifying
a shallower path in my <template match> and using the
parameter names within my <for> loop instead.

-- dwa

[quoted text, click to view]
AddThis Social Bookmark Button