Discussion:
[saxon] Should "Warning: Running an XSLT 1 stylesheet with an XSLT 2 processor" be ignored?
Peng Yu
2011-11-02 03:46:31 UTC
Permalink
Hi,

I get the following error when try to process the xml and xsl file
with saxon. Should I always ignore such warnings? Or is there a way to
use the corresponding processor depending on the xsl version?

~/linux/bin/src/saxon/saxonxsl/main$ java net.sf.saxon.Transform -xsltversion:?
Help for -xsltversion option
Value: one of 3.0|0.0|2.1|2.0
Meaning: Indicate whether the XSLT processor should support XSLT 2.0 or XSLT 3.0
No processing requested



Warning: at xsl:stylesheet on line 4 column 52 of greeting.xsl:
Running an XSLT 1 stylesheet with an XSLT 2 processor
<html>
<body>
<h1>
Hello, World!

</h1>
</body>
</html>


~/linux/bin/src/saxon/saxonxsl/main$ cat greeting.xml
<?xml version="1.0"?>
<!-- greeting.xml -->
<greeting>
Hello, World!
</greeting>

~/linux/bin/src/saxon/saxonxsl/main$ cat greeting.xsl
<?xml version="1.0"?>
<!-- greeting.xsl -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html"/>

<xsl:template match="/">
<xsl:apply-templates select="greeting"/>
</xsl:template>

<xsl:template match="greeting">
<html>
<body>
<h1>
<xsl:value-of select="."/>
</h1>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
--
Regards,
Peng
Michael Kay
2011-11-02 08:11:56 UTC
Permalink
You will always get this warning if your stylesheet specifies
version="1.0" - it is required by the XSLT 2.0 specification, as a
warning that you need to be aware of possible incompatibilities. If you
want your code to run both with Saxon and with XSLT 1.0 processors, then
you should leave the version attribute set to 1.0, and make sure you are
aware of the incompatibilities (they are listed in detail in appendices
to the W3C specifications). On the other hand, if you only intend to run
your code under Saxon or other XSLT 2.0 processors, you should change
the version attribute to version="2.0".

Michael Kay
Saxonica
Post by Peng Yu
Hi,
I get the following error when try to process the xml and xsl file
with saxon. Should I always ignore such warnings? Or is there a way to
use the corresponding processor depending on the xsl version?
~/linux/bin/src/saxon/saxonxsl/main$ java net.sf.saxon.Transform -xsltversion:?
Help for -xsltversion option
Value: one of 3.0|0.0|2.1|2.0
Meaning: Indicate whether the XSLT processor should support XSLT 2.0 or XSLT 3.0
No processing requested
Running an XSLT 1 stylesheet with an XSLT 2 processor
<html>
<body>
<h1>
Hello, World!
</h1>
</body>
</html>
~/linux/bin/src/saxon/saxonxsl/main$ cat greeting.xml
<?xml version="1.0"?>
<!-- greeting.xml -->
<greeting>
Hello, World!
</greeting>
~/linux/bin/src/saxon/saxonxsl/main$ cat greeting.xsl
<?xml version="1.0"?>
<!-- greeting.xsl -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<xsl:apply-templates select="greeting"/>
</xsl:template>
<xsl:template match="greeting">
<html>
<body>
<h1>
<xsl:value-of select="."/>
</h1>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Loading...