Subject: Re: [xsl] including an XSLT 1.0 stylesheet in a XSLT 2.0 one|
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Fri, 06 Jan 2012 06:43:19 +0000
Michael Kay Saxonica
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.
back to the original question
I'm wondering whether it makes sense to develop part of my stylesheets in 1.0 to leave the door open for using them both client and server side.
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".