[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xsl-list
Subject:    Re: [xsl] Template matching on tunnelled variables
From:       Michael Kay <mike () saxonica ! com>
Date:       2012-02-17 8:48:57
Message-ID: 4F3E1479.8030107 () saxonica ! com
[Download RAW message or body]

On 17/02/2012 04:27, ihe onwuka wrote:
> AFAIK this doesn't work. Why?
>
> --~------------------------------------------------------------------
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
> or e-mail:<mailto:xsl-list-unsubscribe@lists.mulberrytech.com>
> --~--
>
>
Are you asking: why cannot I refer to the value of a tunnel parameter 
within the match pattern of a template?

If so, I agree it would be useful, but the design would be awkward. We 
would have to decide whether the variable needs to be declared in the 
xsl:param elements. If so, having a variable reference before the 
variable declaration would feel strange. If not, allowing a reference to 
an undeclared variable in the match pattern but not in the template body 
would feel strange. It's also difficult to introduce retrospectively 
because a variable in the match pattern is currently defined to refer to 
global variables.

It would also prevent some optimizations, which might be important to 
some implementors. Currently during the course of a single 
transformation, if you do apply-templates twice on the same node in the 
same mode, the same template rule is matched each time; this invariant 
would no longer hold. Since XSLT performance depends critically on being 
smart in the way template pattern matching works, this could be 
significant (though not for Saxon).

Michael Kay
Saxonica

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@lists.mulberrytech.com>
--~--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic