[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: "John E. Simpson" <simpson@xxxxxxxxxxx>
Date: Mon, 18 Sep 2000 20:13:33 -0400
msxml change attribute value
At 10:11 AM 09/19/2000 +1200, Russ Holmes wrote:
I'm trying to test the value of an attribute and the value of the node, but
am having trouble with the test expression.
...
I want to generate HTML for each node 'F' dependent on the value of the 'n'
attribute and the value of the current node.
My XSL looks like;

Need to change a few things in the stylesheet:
1. Change the namespace URI for the xsl: prefix. The one you're using is for a long out-of-date Microsoft IE version, which no one (including MS) recommends any longer.


2. Add a version="1.0" attribute to your <xsl:stylesheet> element.

3. Add a template for your root node.

4. Remove the xsl:choose structure and replace it with a simple xsl:if, and simplify the test condition.

The following stylesheet works with IE5 (July preview release), Saxon, and xt:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:html="http://www.w3.org/TR/REC-html40">

<!-- Might want to use the HTML output method, too -->

  <xsl:template match="/">
    <html>
      <body>
        <xsl:apply-templates />
      </body>
    </html>
  </xsl:template>

  <xsl:template match="F">
    <DIV>
      <!-- Need to test for values of F other than 1?
      If so, you'll need to go back to the xsl:choose/:when
      structure. -->
      <xsl:if test=".=1"><B><xsl:value-of select="@n"/> Works</B></xsl:if>
    </DIV>
  </xsl:template>

</xsl:stylesheet>


==========================================================
John E. Simpson | "If you were going to
http://www.flixml.org | shoot a mime, would you use
XML Q&A: http://www.xml.com | a silencer?" (Steven Wright)



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.