Re: [xsl] E [Xerces] Attribute value "1" of type ID must be an NCName when namespaces are enabled.

Subject: Re: [xsl] E [Xerces] Attribute value "1" of type ID must be an NCName when namespaces are enabled.
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 13 Aug 2009 12:48:41 -0400
At 2009-08-13 11:31 +0200, Manuel Souto Pico wrote:
This might be more an XML-related issue than XSL-related, but it happens in a file that I produced with a XSL stylesheet.

Could you help me interpret this error (in the subject)? What could I do to make the document valid?

Make the attribute value a name instead of a token leading with a digit.


Note that "when namespaces are enabled" is misleading because even without namespaces enabled attributes declared of type ID must have values that are names and the string you have used is not a name (though it is an NMTOKEN).

My (simplified) file is:

<?xml version="1.0" encoding="UTF-8"?>
<!--<!DOCTYPE martif
PUBLIC "ISO 12200:1999A//DTD MARTIF core (DXFcdV04)//EN" "TBXcdv04.dtd">-->
<!DOCTYPE martif SYSTEM "TBXcoreStructV02.dtd">

You do not show us the DTD, but based on the error message I'm assuming it has a declaration along the lines of:


<!ATTLIST termEntry id ID #IMPLIED>

... which means its values must be valid XML names per file:///Z:/data/docs/w3c/Architecture/xml/REC-xml-20081126.htm#sec-attribute-types that states the validity constraint that values of type ID must match the Name production.

<termEntry id="1">

The string "1" is not a valid name.


I hope this helps.

. . . . . . . . . . Ken

--
Interested in these classes?  http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread