Subject: Re: [xsl] including an XSLT 1.0 stylesheet in a XSLT 2.0 one From: TW <zupftom@xxxxxxxxxxxxxx> Date: Fri, 6 Jan 2012 13:03:18 +0100 |
Thanks Michael and David. > > On 05/01/2012 22:04, David Carlisle wrote: >> >> On 05/01/2012 21:03, TW wrote: >>> >>> I suspect that Saxon treats stylesheets that have the version >>> attribute set to 1.0 and are imported into 2.0 stylesheets as if they >>> actually were 2.0 stylesheets. Is that right? >> >> >> no, you can place version= attribute on any xsl element (or xsl:version >> attribute on literal result elements) and the effective value for any xpath >> expression is the value on the nearest ancestor, thus expressions in the >> included stylesheet will be evaluated in backwards compatibility mode in >> this case. >> Do I understand this correctly: all XPath expressions inside an element with version="1.0" are interpreted as XPath 1.0, even if the enclosing elements have (or inherit) version="2.0". (The other way round, using the version attribute on an element inside a 1.0 stylesheet doesn't seem to be valid.) >> >> There can be some confusing side effects from mixing versions, with >> identical expressions behaving differently depending.., I think it's >> probably better to stick version=2 on them all so you get consistent >> behaviour. You can still use the styelsheets in an xslt 1.0 system on a >> browser, the forward-compatible processing that happens in that case is >> specified, so as long as the included modules don't use 2.0 features there >> is no problem using then in a browser even if they say version="2.0". >> So the benefit of putting version="2.0" on the imported stylesheets is that it guarantees I have XPath 2.0 only, and if they are imported by XSLT 1.0, they'll be handled in forward compatibility mode (XPath 1.0). Thomas W.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] build a counter variable, Michael Kay | Thread | Re: [xsl] including an XSLT 1.0 sty, David Carlisle |
Re: [xsl] build a counter variable, Michael Kay | Date | Re: [xsl] including an XSLT 1.0 sty, David Carlisle |
Month |