|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: testing an attribute value and node 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
|
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








