Re: [xml] xsltproc, xsl:version, and alternate prefixes



On Thu, May 31, 2007 at 12:03:04AM -0400, Fred L. Drake, Jr. wrote:
I have a stylesheet that starts this way:

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

This used to work just fine with xsltproc, as of a year or more ago.  I'm not 
sure what version I used to use, but it was probably whatever was packaged in 
Ubuntu at the time.

This evening I went to use that transform again, and it didn't work.  I got 
this error message:

  compilation error: file /home/fdrake/projects/.../xform.xsl line 4 element 
stylesheet
  xsl:version is missing: document may not be a stylesheet

I checked the specification (1.0, 1.1, 2.0), and it's quite clear that this is 
processed in the usual way regarding the namespaces specification.  The 
output file seems to be generated without any problems, so I'm unsure why 
there's any output claiming an error.

  the version attribute should not have a namespace
    http://www.w3.org/TR/xslt#stylesheet-element

 And the rule is set in the preceeding paragraph:
 http://www.w3.org/TR/xslt#xslt-namespace

 "An element from the XSLT namespace may have any attribute not from the XSLT namespace, provided that the 
expanded-name of the attribute has a non-null namespace URI. The presence of such attributes must not change 
the behavior of XSLT elements and functions defined in this document."

  so basically per the spec the 
    xs:version 
attribute is ignored, leading to the compilation layer complaining about it
being missing.

Running "xsltproc --version" gives me:

  Using libxml 20627, libxslt 10120 and libexslt 813
  xsltproc was compiled against libxml 20627, libxslt 10120 and libexslt 813
  libxslt 10120 was compiled against libxml 20627
  libexslt 813 was compiled against libxml 20627

This is a stock install on Ubuntu 7.04.

  I guess older version were more lax about namespacing of attributes,

Any ideas?  I hate ignoring error conditions, but this seems totally bogus.

  The error sounds right to me except maybe the message should avoid 
adding a prefix.
  Just fix your stylesheet by removing the 'xs:' prefix for version attribute.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]