[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

id() doesn't work!?

Subject: id() doesn't work!?
From: Aaron Optimizer Digulla <digulla@xxxxxxxx>
Date: Thu, 22 Aug 2002 19:56:13 +0200
stylesheet id
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.