xsl-list
[Top] [All Lists]

Re: [xsl] including an XSLT 1.0 stylesheet in a XSLT 2.0 one

2012-01-06 06:56:38
On 06/01/2012 12:03, TW wrote:
Thanks Michael and David.


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".

they are evaluated as xpath2 in backwards compatibility mode (which is almost, but not quite the same as xpath 1) similarly all xsl instructions (notably xsl:value-of) are evaluated in xsl backward compatibilty mode.

  (The other way
round, using the version attribute on an element inside a 1.0
stylesheet doesn't seem to be valid.)

xsl only allowed version on xsl:stylesheet so you can't nest at arbitrary points, but the original example of having different version= on different stylesheet modules being imported or included applies to xslt 1 as well.


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.


yes

David




________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________

--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--