Re: [xsl] imbedding xsl stylesheet within xml doc ???

Subject: Re: [xsl] imbedding xsl stylesheet within xml doc ???
From: "cking" <cking@xxxxxxxxxx>
Date: Fri, 3 Sep 2004 09:22:27 +0200
Bovy, Stephen J wrote:
>
> What does the following note mean:
>
> NOTE:In order for such an attribute to be used with the XPath id
> function, it must actually be declared in the DTD as being an ID.
>

The DTD (Document Type Definition) defines the structure of an
XML document - it specifies what element names are used, where
the elements can occur, their attributes etc. An attribute can be
defined as being an ID. An example DTD file:

<!ELEMENT countries (country*) >
<!ELEMENT country   (name+) >
<!ATTLIST country 
          id        ID #REQUIRED >
<!ELEMENT name      (#PCDATA) >
<!ATTLIST name 
          lang      IDREF #REQUIRED >

The root element will be <countries>, which contains zero or more
<country> elements. A <country> element has one or more <name> 
children, and a required "id" attribute of type ID. The <name> element 
will hold a string (#PCDATA) and has one "lang" attribute of type IDREF.

So the 'lang' attribute in <name lang="nl"> can be used as a reference
to lookup a country element where <country id="nl">.

Other attribute types include CDATA (just some text) and option lists
like "(yes|no) 'yes'" which means the attribute must have a value of
either "yes" or "no" and the default is 'yes' (that's if the attribute
is not specified in the XML source doc).


So the note means, that you can use the XPath id() function 
only on these type 'ID' elements.

Cheers
Anton Triest

Current Thread