Subject: [xsl] id() doesn't work!? From: Aaron Optimizer Digulla <digulla@xxxxxxxx> Date: Thu, 22 Aug 2002 19:56:13 +0200 |
Hello, When I run this stylesheet: --------------------------- cut -------------------------------------- <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:exsl="http://exslt.org/common" xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="exsl date" > <xsl:import href="page2html.xsl" /> <xsl:import href="functions/date.date.template.xsl" /> <xsl:output method="html" indent="no" encoding="iso-8859-1" /> <xsl:param name="ref">char-usagi</xsl:param> <xsl:template match="/"> <xsl:message>ref=<xsl:value-of select="$ref"/></xsl:message> <xsl:message>id1=<xsl:value-of select="//character[@id = $ref]/name"/></xsl: message> <xsl:message>id2=<xsl:value-of select="id($ref)/name"/></xsl:message> </xsl:template> </xsl:stylesheet> --------------------------- cut -------------------------------------- on this document: --------------------------- cut -------------------------------------- <?xml version="1.0" encoding="iso-8859-1"?> <synopses> <character id="char-usagi"> <name>Miyamoto</name> </character> </synopses> --------------------------- cut -------------------------------------- then I get: ref=char-usagi id1=Miyamoto id2= but I should get: ref=char-usagi id1=Miyamoto id2=Miyamoto Version-Info: Using libxml 20422, libxslt 10018 and libexslt 709 xsltproc was compiled against libxml 20422, libxslt 10018 and libexslt 709 libxslt 10018 was compiled against libxml 20422 libexslt 709 was compiled against libxml 20422 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. Thanks, -- ============================================== 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] A - B, Marrow | Thread | Re: [xsl] id() doesn't work!?, Daniel Veillard |
Re: [xsl] getting distinct content , Kurt George Gjerde | Date | [xsl] Handling forms in xsl, Brian Hickey |
Month |