Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 7th, 2007, 06:12 AM
Authorized User
 
Join Date: Jul 2006
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default simplifying an expression

Just wanted to know if there is any way to simplify an expression of this kind:

<xsl:if test="'LS1' = $fras or 'LS2' = $fras or 'LS3' = $fras or 'LS4' = $fras or 'LS5' = $fras or 'LS6' = $fras or 'LSO' = $fras">

In some parts of my application Im going to need to compare more than 20 strings so I would be happy if someone could tell me if there is any way to make this kind of expressions simpler.

Thanks for the help

Tomi.

 
Old March 7th, 2007, 06:46 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

In 2.0 you can do

test="$fras = ('LS1', 'LS2', 'LS3'...)"

Alternatively put the strings into an XML document

<lookup>
 <v>LS1</v>
 <v>LS2</v>
 <v>LS3</v>
  ...

and do test="$fras = $lookup/lookup/v".



Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Message> in query expression <expression>. (Error ybg1 Access 5 July 15th, 2007 05:42 AM
sort by expression ronisc XSLT 1 December 17th, 2006 02:36 PM
Validator expression Maxxim ASP.NET 1.0 and 1.1 Professional 1 December 3rd, 2006 07:07 AM
Regular expression C# radhakrishnan1976 General .NET 1 February 19th, 2006 01:11 AM
'OR' Expression saturdave ASP.NET 1.0 and 1.1 Basics 2 February 17th, 2004 03:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.