Re: [xsl] id() doesn't work!?

Subject: Re: [xsl] id() doesn't work!?
From: Daniel Veillard <daniel@xxxxxxxxxxxx>
Date: Fri, 23 Aug 2002 12:20:05 +0200
On Thu, Aug 22, 2002 at 07:56:13PM +0200, Aaron Optimizer Digulla wrote:
> --------------------------- cut --------------------------------------
> <?xml version="1.0" encoding="iso-8859-1"?>
> <synopses>
>     <character id="char-usagi">
>             <name>Miyamoto</name>
>         </character>
> </synopses>
> --------------------------- cut --------------------------------------

  No DTD -> there is no id() defined for this document.

> After some hours of try&error, I finally found why it doesn't
> work: If the elements are not declared in a DTD, then id() doesn't
> work. DUH.
> Can someone please add a check to xsltproc which prints a warning if
> id() is used in a document which is only well-formed or, even better,
> if the document doesn't have any attributes with are declared as
> ID attributes.

  Hum, the spec (XPath) says:

  NOTE: If a document does not have a DTD, then no element in the document will have a unique ID.

  this doesn't sound like a special processing should be attempted.
Moreover since XPath id() is also shared for example by XPointer,
that mean the XPointer would also generate the warning message, and 
I definitely don't want this 


should not generate a warning IMHO.

  To me it's really a stylesheet/framework design constraint
if you use id() it will *never* work if your document doesn't have
a DOCTYPE (well at least for XPath-1.0 ...).

  So I'm not tempted to try this, you can still argue to convince
me though :-)


Daniel Veillard      | Red Hat Network
veillard@xxxxxxxxxx  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

 XSL-List info and archive:

Current Thread