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

Subject: Re: [xsl] id() doesn't work!?
From: Aaron Optimizer Digulla <digulla@xxxxxxxx>
Date: Sun, 25 Aug 2002 16:50:48 +0200
On Fri, Aug 23, 2002 at 12:20:05PM +0200, Daniel Veillard wrote:

> 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:
> 
> http://www.w3.org/TR/xpath#unique-id
> 
> --------------------------
>   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 
> 
>   #xpointer(id('foo'))xpointer(//*[@id='foo'])
> 
> 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 ...).

This is exactly my point: I just want xsltproc to tell me if id() cannot
work.

It's the usual thing: Where is knowledge stored? If the user has to know,
then that means that several thousand people must do something. If the
program knows, then only one person (the developer) must do something.

I obviously prefer that you do something ;-)

Not having used xpointer to date, I don't know of the implications of it
and how hard it would be to solve the warning problem (maybe id() can
"throw an exception" somehow and xpointer() can discard it while the
normal use would display it or somesuch - I would have to look at the
sources to say that) but my guess is that it would be a simple thing
for you to do.

So please think if you can make life for many thousand people a little
bit more simple.

-- 
==============================================
Sowatec AG,       CH-8330 Pfäffikon (ZH)
Witzbergstr. 7,   http://www.sowatec.com
Tel: +41-(0)1-952 55 55
Fax: +41-(0)1-952 55 66
----------------------------------------------
Aaron "Optimizer" Digulla, digulla@xxxxxxxxxxx
==============================================

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


Current Thread