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

Subject: Re: [xsl] A colon is not allowed in the name
From: "Deborah Pickett" <debbiep-list-xsl@xxxxxxxxxx>
Date: Wed, 25 Mar 2009 16:46:42 +1100 (EST)
Hi Navpreet,

You haven't said whether this document:

> <header type="new">
>        <?QM: GENERATOR [Ref] 10055: ParaHeading: NEW?>Generate New Data
> </header>

uses namespaces anywhere, nor how you are reading it in, nor what you are
using to process it.  This matters, because:

> ERROR:  'A colon is not allowed in the name 'QM:' when namespaces are
> enabled.'

is a rule that comes straight from the Namespaces-in-XML spec:
http://www.w3.org/TR/xml-names/#Conformance

QUOTE: in a namespace-well-formed document [...] No entity names,
processing instruction targets, or notation names contain any colons.

You can only avoid that restriction by (a) having whoever produced that
processing instruction stop using a colon (which you have said is outside
your power), or (b) strictly avoiding the use of namespaces in the source
document.  Doing (b) may require you to remind the XML parser that it is
parsing a non-namespaced document (see
http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#isNamespaceAware()
for one such mechanism).

As an aside, you can get away with (b) only because the XML spec
reluctantly permits colons in names, though the spec pretty much questions
the intelligence of anyone who does it:
http://www.w3.org/TR/xml/#sec-common-syn

QUOTE: The Namespaces in XML Recommendation [XML Names] assigns a meaning
to names containing colon characters. Therefore, authors should not use
the colon in XML names except for namespace purposes

You should show that to the person who stopped you from pursuing option (a).

Current Thread