Re: id(..) to retrieve an attribute value

Subject: Re: id(..) to retrieve an attribute value
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 12 Feb 1999 11:32:01 -0500
At 99/02/12 15:59 +0100, Gurgone wrote:
>I've a little problem:

I don't think so.

>I've this kind of .xml.....
>and I'd like to obtain.....
>I thought to do something like this...
>  <body bgcolor="{id(@color)/@value}">
>but this is can I do it properly ??

But it is correct, and it works just fine with XT (but doesn't work with
IE5b2, though is expected to with the final version of IE5).

Perhaps it isn't your XSL that's wrong; have you reviewed your XML
declaration of the attribute types?

I hope the illustration below helps.  I saw your claim and thought that
was, indeed, the way to approach your problem, so I tried it for myself and
your proposed use of the syntax works perfectly.

........... Ken

T:\FTEMP>type test.xml
<?xml version="1.0"?>
<!DOCTYPE wall [
<!ELEMENT wall ( attribute+ )>
<!ELEMENT attribute EMPTY>
<!ATTLIST attribute id ID #REQUIRED
                    value CDATA #REQUIRED>
<wall color="wall-color">
<attribute id="wall-color" value="brown"/>
T:\FTEMP>type test.xsl
<?xml version="1.0"?>


<xsl:template match="/">                    <!-- root rule -->
    <xsl:apply-templates select="wall"/>

<xsl:template match="wall">
    <body bgcolor="{id(@color)/@value}">


T:\FTEMP>call xsl test.xml test.xsl test.htm
T:\FTEMP>type test.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<body bgcolor="brown">


G. Ken Holman         mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.
Box 266,                                V: +1(613)489-0999
Kars, Ontario CANADA K0A-2E0            F: +1(613)489-0995
Next XSL Training:      X-Tech:1999-03-07  WWW8:1999-05-11

 XSL-List info and archive:

Current Thread