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

Re: testing an attribute value and node value

Subject: Re: testing an attribute value and node value
From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx>
Date: Tue, 19 Sep 2000 11:53:45 +1200
Re: testing an attribute value and node value
Hi Russ,

It appears from your stylesheet namespace that you're using an old version of IE5,
so the following may not work. (Actually, I haven't had time to test it so it may
not work at all.)

Russ Holmes wrote:
> 
> I want to generate HTML for each node 'F' dependent on the value of the 'n'
> attribute and the value of the current node.

Do you only want to produce output for certain values of @n? If not, then
you should be fine with this.

<xsl:template match="F">
  <DIV>
      <xsl:if test=". = '1'">
        <b>
          <xsl:value-of select="concat(@n, ' Works')" />
        </b>
      </xsl:if>
  </DIV>
</xsl:template>

Note that your test expression

>       <xsl:when test="@n[.='100' and //F[.='1']]">

is not selecting the parent F element of the @n attribute as you may be
thinking. "//F" selects all F elements in the document. If you want to
test on specific values of @n as well as the contents of F being "1", then
try

<xsl:template match="F">
  <DIV>
      <xsl:if test=". = '1' and @n = '100'"> ...

> My other thought was to alter the XMl slightly so that it had the '1' value
> as an attribute..

Hopefully, it shouldn't be necessary.

Hope this helps.

-- 
Warren Hedley
Department of Engineering Science
Auckland University
New Zealand


 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.