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

Re: Attribute test problem solved

Subject: Re: Attribute test problem solved
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 13 Apr 2000 13:57:31 +0100 (BST)
secur.classif
why the nested xsl:choose? Your posting was equivalent to a single
xsl:choose:

<xsl:choose>
	<xsl:when test="//@secur.classif='P'">
          <xsl:text>PRIORITY</xsl:text>
	</xsl:when>
        <xsl:when test="//@secur.classif='F'">
	  <xsl:text>FAST</xsl:text>	
	</xsl:when>	
	<xsl:when test="//@secur.classif='R'">
	 <xsl:text>ROUTINE</xsl:text>
        </xsl:when>	
        <xsl:otherwise>
         <xsl:text>SLOW</xsl:text>
	</xsl:otherwise>
</xsl:choose> 

but it is often simpler to use xpath rather than xsl:choose
the above is equivalent to:

<xsl:variable name="x" select="//@secur.classif"/>
<xsl:value-of select="document('')/*/x:classif/@*
                          [name(.)=$x or name()='X'][1]"/>

and at the top of your sheet


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
                xmlns:x="file:/dev/null"
                >

<x:classif P="PRIORITY"/>
<x:classif F="FAST"/>
<x:classif P="ROUTINE"/>
<x:classif X="SLOW"/>


David


 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.