XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
asdf asdfSubject: Multiple OR statements, a better way?
Author: asdf asdf
Date: 20 Nov 2006 03:37 AM
Good afternoon everybody!

I have this problem where i need to check a the value of a node and do something when it is true

I am using

xsl:if test="myele = 5 or myele = 9 or myele = 10......"

but there are about 50 choices that need to be included in this test, surely there is a better way,

Other programming languages, I am so used to just creating a "list" and then saying myele in list but xsl doesn't seem to have this syntax

Any help would be grand, come on show me the light!

Postnext
James DurningSubject: Multiple OR statements, a better way?
Author: James Durning
Date: 20 Nov 2006 01:27 PM
You could create an xml fragment in your xslt to have the possible choices, eg:
<my:values xmlns:my="internal">
<value>5</value>
<value>9</value>
<value>10</value>
<value>15</value>
...
</my:values>

and then
<xsl:if test="myele = document('')//value">
or
<xsl:if test="document('')//value[.=current()/myele]">

Posttop
asdf asdfSubject: Multiple OR statements, a better way?
Author: asdf asdf
Date: 22 Nov 2006 04:09 AM
Thanks alot James, you have shed a great deal of light on many of the problems that I will encounter in the next couple of months

XML is grand!

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.