xsl-list
[Top] [All Lists]

Re: [xsl] NCName, QName and colons

2010-02-22 06:43:55
Michael Kay wrote:
"XML documents operated on by XPath must conform to the XML Namespaces
Recommendation [XML Names]."
Is this rule binding on an XSLT 2 processor as well (by virtue of
its association with XPath 2)?

Source document:

<:/>

Stylesheet:

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

   <xsl:output method="xml" omit-xml-declaration="yes"/>

   <xsl:template match="node()|@*">
       <xsl:copy>
           <xsl:apply-templates select="node()|@*"/>
       </xsl:copy>
   </xsl:template>

</xsl:stylesheet>

Output:

<:/>


The error messages that I posted when initiating this thread a few weeks ago
gave me a forensic clue that the above might work (i.e. without an error
occurring).

Cheers
Justin Johansson


<original message>
This seems rather odd.

Running an XSLT identity transform over the following source document
with Saxon 9b produces the error underneath:

<?xml version="1.0" encoding="UTF-8" ?>

<:a:apple xmlns:a="foo">
  <banana/>
</:a:apple>

Error on line 3 column 25 of foo.xml:
SXXP0003: Error reported by XML parser: The prefix ":a" for element ":a:apple" is not bound.TransformerException: net.sf.saxon.trans.XPathException: org.xml.sax.SAXParseException: The prefix ":a" for element ":a:apple" is not bound.

Obviously the source document is not valid XML but the error message
is confusing.

Since when was
1) a colon character allowed to start an NCName which a prefix is, and
2) a QName allowed to contain 2 colon characters
which the error message suggests?

Cheers

Justin Johansson
</original message>



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--