[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: advice on node-set fallback needed

Subject: RE: advice on node-set fallback needed
From: "Julian Reschke" <julian.reschke@xxxxxx>
Date: Tue, 19 Aug 2003 10:19:59 +0200
function available msxsl node set
Thanks Mike.

> Are you saying MSXML4 gives you a compile-time error for a path
> expression that misuses an RTF?

Yes.

> The XSLT 1.0 spec is very unspecific about which errors are compile-time
> errors and which are run-time. The spec merely says that this operation
> "is not permitted". But you should be able to get it to compile by using
> forwards-compatible mode, which you can invoke by setting version="2.0"
> (or any value other than 1.0).

So I'm now trying:

  <xsl:choose>
    <xsl:when test="function-available('exsl:node-set')">
	    <xsl:text>exsl: </xsl:text><xsl:value-of
select="name(exsl:node-set($test)/node())" />
    </xsl:when>
    <xsl:when test="function-available('msxsl:node-set')">
	    <xsl:text>msxsl: </xsl:text><xsl:value-of
select="name(msxsl:node-set($test)/node())" />
    </xsl:when>
    <xsl:otherwise>
	    <xsl:text>(none): </xsl:text><xsl:value-of version="2.0"
select="name($test/node())" />
   </xsl:otherwise>
  </xsl:choose>

However this breaks execution in Saxon 6.5.3 and MSXML completely:

(MSXML3 and MSXML4)

Error occurred while compiling stylesheet 'test.xslt'.

Code:   0x80004005
Attribute 'version' is invalid on 'xsl:value-of'.

(Saxon)

  Attribute version is not allowed on this element
Transformation failed: Failed to compile stylesheet. 1 error detected.


Using xsl:version instead of version yields:

(MSXML3)

Works.

(MSXML4)

Error occurred while compiling stylesheet 'test.xslt'.

Code:   0x80004005
Expression must evaluate to a node-set.

name(-->$test<--/node())

(Saxon)

  Attribute xsl:version is not allowed on this element
Transformation failed: Failed to compile stylesheet. 1 error detected.


What *does* seem to work is setting version="2.0" on the stylesheet element
itself. However I'm a bit concerned that this will instruct an XSLT 2.0 in a
non-XSLT-1.0 compatible manner.

However, this:

  <xsl:choose>
    <xsl:when test="function-available('exsl:node-set')">
	    <xsl:text>exsl: </xsl:text><xsl:value-of
select="name(exsl:node-set($test)/node())" />
    </xsl:when>
    <xsl:when test="function-available('msxsl:node-set')">
	    <xsl:text>msxsl: </xsl:text><xsl:value-of
select="name(msxsl:node-set($test)/node())" />
    </xsl:when>
    <xsl:when test="system-property('xsl:version') &gt;= 2.0">
	    <xsl:text>(XSLT2.0): </xsl:text><xsl:value-of version="2.0"
select="name($test/node())" />
    </xsl:when>
    <xsl:otherwise>
	    <xsl:text>no way</xsl:text>
   </xsl:otherwise>
  </xsl:choose>

seems to work with all 1.0 processors I tried, and should also work on an
XSLT-2.0 processor without exslt:node-set(), right?

> The rules for what a 2.0 processor should do when given a stylesheet
> that says version="1.0" have not fully stabilised, but the next version
> of the spec is likely to say that the processor should give a warning
> about possible incompatibilities, and then execute the stylesheet in
> backwards-compatible mode. It should not disallow use of 2.0 features
> just because the stylesheet says version="1.0". In this case, however,
> your stylesheet is using a 2.0 feature so it should say version="2.0".
>
> Michael Kay

Thank for the help,

Julian

--
<green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.