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 

so try _33 instead of 33

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:
  <!ATTLIST BBB          id ID #IMPLIED>

this defines attribute id as an ID attribute, so you could also say

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


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

fon 0211-6015919
fax 0211-6015917

 XSL-List info and archive:

Current Thread