|
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 wrong.......how 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+ )>
<!ATTLIST wall color IDREF #REQUIRED>
<!ELEMENT attribute EMPTY>
<!ATTLIST attribute id ID #REQUIRED
value CDATA #REQUIRED>
]>
<wall color="wall-color">
<attribute id="wall-color" value="brown"/>
</wall>
T:\FTEMP>type test.xsl
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/TR/WD-xsl"
xmlns="http://www.w3.org/TR/REC-html40"
result-ns="">
<xsl:template match="/"> <!-- root rule -->
<xsl:apply-templates select="wall"/>
</xsl:template>
<xsl:template match="wall">
<body bgcolor="{id(@color)/@value}">
</body>
</xsl:template>
</xsl:stylesheet>
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">
</body>
T:\FTEMP>
--
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, V: +1(613)489-0999
Kars, Ontario CANADA K0A-2E0 F: +1(613)489-0995
Training: http://www.CraneSoftwrights.com/s/schedule.htm
Resources: http://www.CraneSoftwrights.com/s/resources.htm
Shareware: http://www.CraneSoftwrights.com/s/shareware.htm
Next XSL Training: X-Tech:1999-03-07 WWW8:1999-05-11
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| id(..) to retrieve an attribute val, Gurgone | Thread | RE: id(..) to retrieve an attribute, David Schach |
| id(..) to retrieve an attribute val, Gurgone | Date | Re: Venting, Elliotte Rusty Harol |
| Month |