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

Re: choose/when question

Subject: Re: choose/when question
From: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Wed, 22 Aug 2001 18:08:41 +0200
when question
Jeni Tennison <mail@xxxxxxxxxxxxxxxx> wrote
> 
> There's no simple way of checking whether the value of @number is in a
> list in the way that you tried, although you could hold them in some
> XML and test against that
[snip]

In order to elaborate, look at the following style sheet for an example
how this could be done:
 <?xml version="1.0"?>
 <xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:data="some.uri.you.control">

  <data:valid-numbers>
    <value>one</value>
    <value>two</value>
  </data:valid-numbers>
  
  <xsl:template match="foo">
    <xsl:choose>
      <xsl:when test="@number=document('')/*/data:valid-numbers/value">
        <!-- do something -->
      </xsl:when>
      <xsl:otherwise>
        <!-- do something else -->
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
 </xsl:stylesheet>

Of course, you could stuff the valid-numbers XML into a separate
XML file if you don't like to have them in the style sheet.

HTH
J.Pietschmann

 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.