Re: [xsl] null stylesheet?

Subject: Re: [xsl] null stylesheet?
From: "Kulas, Jack" <Jkulas@xxxxxxxxxx>
Date: Thu, 1 May 2014 03:10:03 -0000
A most timely thread for me.  I just encountered the "simplified stylesheet."
I ran into it in the first design-pattern example of Chapter 17, "Stylesheet
Design Patterns," in Michael's "XSLT2.0 and XP2ath 2.0, 4th ed."  (BTW, when
can we expect the XSLT 3.0 book?]

The stylesheet there starts with

	<html xmlns:xsl="http://www.w3.org/1999/XSL/Transform";   xsl:version="2.0">

and has no xsl:stylsheet element.  It was strange to see instances of XSLT
elements xsl:for-each  and xsl: value-of in that stylesheet without the
xs:stylesheet element as the outermost element.  I since learned that as long
as the XSLT namespace is declared and there is an xsl:version attribute in its
outermost element, which can't be in the XSLT namespace, it's an XSLT
stylesheet!

Thus the following also counts as an XSLT stylesheet:

	<html xmlns:xsl="http://www.w3.org/1999/XSL/Transform";   xsl:version="2.0"/>

--Jack Kulas
LSI, Inc
Jacksonvlle, FL

-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
>
> and that works perfectly well. But then I tried the slightly simpler
>
>  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> version="1.0"/>

Yes, that's a legal stylesheet.
>
> But Saxon-HE 9.5.1.3J run from the commandline complains that "The
> supplied file does not appear to be a stylesheet"
> (this is an error, not a warning; # XTSE0150).
>

I suspect you got the command line arguments wrong. This message from Saxon
means that the file supplied as the stylesheet document did not have
xsl:stylesheet or xsl:transform as its root. In fact more specifically I think
it means the local name of the root element was not "stylesheet" or
"transform" - you get a different message if only the namespace is wrong.

Michael Kay
Saxonica

Current Thread