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

Subject: RE: [xsl] A colon is not allowed in the name
From: "SINGH Navpreet" <navpreet.singh@xxxxxxxxxxxxxx>
Date: Wed, 25 Mar 2009 17:06:29 +1100
Hi Deborah,

Thanks for your reply.
I am using usual namespaces in xsl file not in xml file as follows

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:exsl="http://exslt.org/common";
    extension-element-prefixes="exsl"
    xmlns:xalan="http://xml.apache.org/xalan";
xmlns:fo="http://www.w3.org/1999/XSL/Format";>

I am creating javax.xml.transform.Source object for xml file and pass it
to transform method of javax.xml.transform.Transformer.

I've written a java class that uses org.apache.fop.apps.Fop to convert
xml to PDF using xsl file.

Navpreet



-----Original Message-----
From: Deborah Pickett [mailto:debbiep-list-xsl@xxxxxxxxxx]
Sent: Wednesday, 25 March 2009 4:47 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] A colon is not allowed in the name

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/DocumentBuilde
rFactory.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).


Disclaimer :
The contents of this e-mail including any attachments are intended only
for the person or entity to which this e-mail is addressed.  If you are not,
or believe you may not be, the intended recipient, please advise the sender
immediately by return e-mail, delete this e-mail and destroy any copies.
The Company does not warrant nor guarantee that this email communication is
free
from errors, virus, interception or interference.

Current Thread