Re: [xsl] Some Pointers on XSLT 2.0 vs. 1.0 and for Using XSLT 2.0 on the Web

Subject: Re: [xsl] Some Pointers on XSLT 2.0 vs. 1.0 and for Using XSLT 2.0 on the Web
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: Mon, 13 Oct 2008 19:09:08 +0100
>>>>> "Jesse" == Jesse Heines <heines@xxxxxxxxxx> writes:

    Jesse> (1) Some of my XSL code inadvertently contained \ as a
    Jesse> "file separator" (using the Java term) in file paths.  This
    Jesse> was not a problem on Windows, of course, where paths use
    Jesse> backslashes, but it caused Saxon errors on Linux, which was
    Jesse> of course expecting /.  It seems that XSLT 1.0 "forgave"
    Jesse> the error on Linux and must have the translated \ in paths
    Jesse> to / because I never got an error before, but XSLT 2.0 is
    Jesse> not as forgiving.  Note that the / works just as well as \
    Jesse> on Windows, which is true in Java code as well.

I don't think this is an XSLT 1.0 versus XSLT 2.0 issue - as neither
has file paths at all.

File URIs, on the other hand, like any other URI, may not contain the
backslash character. This is equally true for any specification that
uses URIs, including both XSLT 1.0 and 2.0.

So i think it was the XSLT processor that you were using for
interpreting XSLT 1.0 that was buggy (not forgiving - although your
users might have been).

    Jesse> (3) Another error that XSLT 1.0 forgave and XSLT 2.0 did
    Jesse> not is that I inadvertently put a test attribute on an
    Jesse> xsl:choose element.  That was obviously a mistake, but I
    Jesse> never caught it because XSLT 1.0 didn't complain.  The more
    Jesse> strict XSLT 2.0, however, wouldn't compile the stylesheet.

Ditto, I think.

    Jesse> (4) When working on the web, problems with an XSLT
    Jesse> stylesheet cause the web page to display something like:

    Jesse>      javax.xml.transform.TransformerConfigurationException:
    Jesse> Failed to compile stylesheet. 6 errors detected.

Again, this is a processor thing. Nothing to do with XSLT.

    Jesse> (5) One last small thing about what you see above.  When
    Jesse> using XSLT 1.0 stylesheets with saxon9.jar on the web, the
    Jesse> warning shown above:

    Jesse>      Warning: at xsl:stylesheet on line 12 column 80 of
    Jesse> common-lecs.xsl: Running an XSLT 1.0 stylesheet with an
    Jesse> XSLT 2.0 processor

    Jesse> does not show up on the web page, so I didn't have to go
    Jesse> through and change all the xsl:stylesheet declarations on
    Jesse> my website:

    Jesse>      <xsl:stylesheet
    Jesse> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    Jesse> version="1.0">

    Jesse> This would have been a tedious job, as there are over 150
    Jesse> XSL stylesheets on my website and I have a healthy fear
    Jesse> making global changes on multiple files.

You can supress the warning (and this is actually mandated by the XSLT
2.0 specification - although it doesn't mandate how).

-- 
Colin Adams
Preston Lancashire

Current Thread