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



Daniel Veillard wrote:
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.

I'm sorry Daniel, but I disagree with your interpretation here; the spec
lists a few attributes, including version for the transform/stylesheet
element, and the paragraphs before it do indeed say:

""
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.
Thus, an XSLT processor is always free to ignore such attributes, and
must ignore such attributes without giving an error if it does not
recognize the namespace URI. Such attributes can provide, for example,
unique identifiers, optimization hints, or documentation.

It is an error for an element from the XSLT namespace to have attributes
with expanded-names that have null namespace URIs (i.e. attributes with
unprefixed names) other than attributes defined for the element in this
document.
""

What I read this as saying is:
- a namespace-prefixed attribute from a namespace other than the XSLT
  one is allowed, and the processor is free to ignore them (and it can't
  even complain about them if the namespace is unknown to it)
- a non-namespace-prefixed attribute on an XSLT element has to be one
  of those specifically specified

This says NOTHING about ignoring xs:version, provided that xs is defined
as a prefix for the XSLT namespace; the paragraph about ignoring
attributes specifically says "any attribute NOT FROM THE XSLT NAMESPACE"
(emphasis mine). So my reading is that using a prefix on XSLT attributes
for XSLT elements is allowed but not required (except that you may only
drop the prefix if the attribute is specifically listed in the spec for
that element).



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