W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2006

Re: declaring xml:id attributes

From: G. Ken Holman <gkholman@CraneSoftwrights.com>
Date: Thu, 14 Sep 2006 22:09:48 -0400
Message-Id: <>
To: xmlschema-dev@w3.org

At 2006-09-14 23:52 +0200, Wolfgang Jeltsch wrote:
>I'm developing a schema in the XML Schema language and want to specify that
>certain elements of my document type have xml:id attributes.  However, the
>name attribute of the xsd:attribute is of type xsd:NCName but xml:id is not a
>NCName.  How do I achieve what I want?

By importing a schema that declares this attribute.

This is what I am doing in my code list validation work:

Vocabulary schema:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"

<!-- xml:id per http://www.w3.org/TR/2005/REC-xml-id-20050909/ -->
<xsd:import schemaLocation="xmlid.xsd"

  <xsd:documentation xml:lang="en">
    A document model of the association of document contexts with the
    URIs of expressions of enumerations of coded values.
<!--a given code list with a unique identifier for reference in contexts-->
<xsd:element name="CodeList">
     <xsd:attribute ref="xml:id"/>
     <xsd:attribute name="uri" type="xsd:anyURI"/>

xmlid.xsd schema:

<?xml version="1.0" encoding="ISO-8859-1"?>
   Verbatim from http://www.w3.org/TR/2005/REC-xml-id-20050909/ section D.2

   $Id: xmlid.xsd,v 1.1 2006/06/18 16:56:30 G. Ken Holman Exp $
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

     <xs:attribute name="id" type="xs:ID"/>



I hope this helps.

. . . . . . . . . . Ken

UBL/XML/XSLT/XSL-FO training: Vårø, Denmark 2006-10-02/06,11-20/24
UBL International 2006  2006-11-13/17 http://www.ublconference.com
World-wide corporate, govt. & user group UBL, XSL, & XML training.
G. Ken Holman                 mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal
Received on Friday, 15 September 2006 02:10:10 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:10 UTC