|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: attribute value test.
Hello Dave!
At 99/06/03 12:36 +0100, DPawson@xxxxxxxxxxx wrote:
>I'm trying to test if a nodes parent contains an attribute named 'inserted'
>with value 'yes'
>
><xsl:choose>
> <xsl:when test="../@inserted ='yes' ">
> <xsl:attribute name="style">color: red</xsl:attribute>
> </xsl:when>
> </xsl:choose>
>
>
>xt keeps telling me there is an unexpected token in the line
>beginning xsl:when.
Since it looked correct to me, I copied your text verbatim into a test
script and it appears to work just fine (see below).
Perhaps one of your spaces isn't a space but a ? or perhaps a quote
is a word processing font quote and not an ASCII quote?
Perhaps you are not running with XT19990514 (I haven't tested the below
with any earlier version)?
Sorry I can't think of anything more.
............ Ken
T:\davep>type test.xml
<?xml version="1.0"?>
<start>
<tests inserted="yes">
<test>A test</test>
</tests>
<tests inserted="no">
<test>Another test</test>
</tests>
</start>
T:\davep>type test.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
<xsl:template match="//test"> <!--root rule-->
<thing>
<xsl:choose>
<xsl:when test="../@inserted ='yes' ">
<xsl:attribute name="style">color: red</xsl:attribute>
</xsl:when>
</xsl:choose>
</thing>
</xsl:template>
</xsl:stylesheet>
T:\davep>call xsl test.xml test.xsl testout.xml
T:\davep>type testout.xml
<thing style="color: red"/>
<thing/>
T:\davep>
--
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995)
Website: XSL/XML/DSSSL/SGML services outline, XSL/DSSSL shareware,
stylesheet resource library, conference training schedule,
commercial stylesheet training materials, on-line XSL CBT.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








