Re: [xsl] Selecting and "id"

Subject: Re: [xsl] Selecting and "id"
From: Janning Vygen <vygen@xxxxxxxxxxxx>
Date: Tue, 5 Jun 2001 19:07:48 +0200
Am Dienstag,  5. Juni 2001 18:31 schrieb Jeffrey Langdon:
> Can someone please tell me why I cannot get the following to work.   I am
> trying to select the id number for specific element.
>
> <!-- XML -->
>
> <AAA>
>      <BBB id = "11" >B1 </BBB>
>      <BBB id = "22" >B2 </BBB>
>      <BBB id = "33" >B3 </BBB>
> </AAA>

Two problems. 
first: the value of an ID attribute cant be a number. It has to be an "XML 
Name" and XML Names must start with only with letters, ideograms or 
underscore.

so try _33 instead of 33

second:
you have to use a DTD to define what attribute are of type ID!!
the id() function doesnt select all Attributes named 'id' but selects all 
elements with attribute of TYPE ID!!!!!

add to your XML at the beginning lines like this:
<!DOCTYPE AAA [
  <!ATTLIST BBB          id ID #IMPLIED>
]>

this defines attribute id as an ID attribute, so you could also say
  <!ATTLIST BBB  myident ID #IMPLIED>

and still the id() function knows what to look for.

janning




-- 
Planwerk 6 /websolutions
Herzogstraße 86
40215 Düsseldorf

fon 0211-6015919
fax 0211-6015917
http://www.planwerk6.de

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread