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: 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 ...). So I'm not tempted to try this, you can still argue to convince me though :-) Daniel -- Daniel Veillard | Red Hat Network http://redhat.com/products/network/ veillard@xxxxxxxxxx | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] id() doesn't work!?, Aaron Optimizer Digu | Thread | Re: [xsl] id() doesn't work!?, Aaron Optimizer Digu |
RE: [xsl] extracting data in CDATA , Jarno . Elovirta | Date | Re: [xsl] extracting data in CDATA , David Carlisle |
Month |