Re: [xsl] A colon is not allowed in the name

Subject: Re: [xsl] A colon is not allowed in the name
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 26 Mar 2009 10:16:45 -0400
Hi,

At 04:46 AM 3/26/2009, Deborah wrote:
Florent Georges wrote:
> Deborah Pickett wrote:
>>> XSLT will only handle input that is well-formed XML
>>> conforming to the Namespaces recommendation.
>> I'm curious: why?
> [...] Because the input to the transform is an abstract
> tree represented as an XDM instance.

I should learn to phrase my questions more clearly.  Three answers,
three different takes on what I was asking. :)  Florent, I think that
your answer best answers the question I thought I was asking.

Florent's answer does, however, raise certain other questions.


For example, when I run a convenient copy of HTML Tidy on this, asking for XHTML:

<html>
 <head><title>ns test</title></head>
 <body>
 <p>Namespace test</p>
 <?z: ?>
 </body>
</html>

I get this (with no errors reported, just a warning that my input had no DOCTYPE):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta name="generator" content=
"HTML Tidy for Cygwin (vers 1st September 2004), see www.w3.org" />
<title>ns test</title>
</head>
<body>
<p>Namespace test</p>
<?z: ?>
</body>
</html>

The bottom line seems to be that at least one popular processor (released by W3C, even) does not respect every rule restricting colons in namespace-conformant documents.

This is taking us off topic. But the OP should know

(a) XSLT may not process input that has colons in PI names, as they're forbidden in namespace-conforming documents;

(b) Nevertheless YMMV using different processors, simply because this is such an edge case. Xerces errors on the document generated by Tidy above.

Best practice is probably to follow the hint of the XML Rec and avoid colons altogether except when you actually have namespaces in mind.

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread