|
[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Using variables in template match patterns?
Subject: Re: Using variables in template match patterns?
From: Geert Josten <Geert.Josten@xxxxxxxxxxx>
Date: Tue, 12 Jul 2005 10:15:57 +0200
|
Thnx Wendell, exactly what I was looking for..
Cheers,
Geert
Wendell Piez wrote:
Geert,
It is not conformant -- no variable references are allowed in XSLT 1.0
match patterns.
(XSLT 1.0 section 5.3: "It is an error for the value of the match
attribute to contain a VariableReference". Other restrictions are
enumerated in section 5.2. But I wonder whether the rule isn't unclear
as it applies to a match pattern in a key declaration, since section 5.3
describes template rules.)
Xalan is (probably) being too permissive here -- you shouldn't expect
portability of code that uses this "feature".
Because such a thing is so useful, this restriction has been loosened
for XSLT 2.0, where any XPath predicate, including one with variable
references, may appear in a pattern.
Cheers,
Wendell
At 09:06 AM 7/11/2005, you wrote:
Hi all,
Can anyone tell me whether it is or isn't conform XSLT (1.0) to use
variable references in template match patterns? I have something like
the following, that is accepted by Xalan, but not by some other parsers:
<!-- top level -->
<xsl:param name="selected" />
<xsl:template match="entry[@id = $selected]">
...
</xsl:template>
I also use variables to add a filter on a key pattern, something like
this:
<xsl:key name="selected-entries" match="entry[@parent-id =
$selected]" use="@id" />
Again, Xalan is happy, but some other parsers aren't..
Who is right?
======================================================================
Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
--
Geert.Josten@xxxxxxxxxxx
IT-consultant at Daidalos BV, Bleiswijk (NL)
http://www.daidalos.nl/
tel:+31-(0)10-850 12 00
fax:+31-(0)10-850 11 99
GPG: 1024D/12DEBB50

|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
| RSS 2.0 |
|
| Atom 0.3 |
|
|