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

Re: SETS comparison..?

Subject: Re: SETS comparison..?
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 23 Jan 2002 17:19:47 +0000
Re:  SETS comparison..?
Hi Martijn,

> Is it possible to group values not having to repeat the same
> attribute over and over?
>
> e.g.: <xsl:if test=". in ['a', 'b', 'd']">

In XPath 1.0, you have to do:

  . = 'a' or . = 'b' or . = 'd'

Another option is to create a node set containing the values that
you're interested in, and use the existential semantics of = to do the
test. So if you have $values be set to a node set that contains the
following elements:

  <value>a</value>
  <value>b</value>
  <value>d</value>

then you can just do:

  . = $values

Creating the node set is a little tricky - you can put the XML in a
separate document or embed it in the stylesheet, and use the
document() function to access it; or you can create a variable holding
a result tree fragment with those value elements in it, and then
convert that to a node set with a implementation-specific node-set()
extension function.

---

This all becomes a lot easier in XPath 2.0. With XPath 2.0, you just
do:

  . = ('a', 'b', 'd')

and there you have it.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.