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

Re: attribute value test.

Subject: Re: attribute value test.
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 03 Jun 1999 09:26:53 -0400
xsl test attribute value
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 &nbsp;?  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


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.