Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 29th, 2006, 02:38 AM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ramesh.kumarm
Default Check two string values on a single variable??

<xsl:variable name="temp1">
  <xsl:value-of select="local-name()"/>
</xsl:variable>

Need to check the variable $temp1 for values 'RefNum' OR 'Qualifier'

I tried this...but this throws an illegal expression.
<xsl:if test=" $temp1 = 'RefNum' | 'Qualifier'">

i also tried
<xsl:if test=" $temp1 = conatins('RefNum','Qualifier')">

Still nogo

Kindly advice.
thanx.



__________________
Ramesh
\"Always Look For Something NEW\"
Reply With Quote
  #2 (permalink)  
Old June 29th, 2006, 02:48 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Never write this:

<xsl:variable name="temp1">
  <xsl:value-of select="local-name()"/>
</xsl:variable>

when you mean this:

<xsl:variable name="temp1" select="local-name()"/>

unless you're paid for the number of lines of code you write and don't care about efficiency. The former construct is creating a result tree fragment - a pretty complex data structure with all sorts of properties like node identity, base URI, etc - when all you want is a string.

To answer your question, a lot of people seem to have trouble finding this in the specs and I've never understood why. The syntax is

<xsl:if test="$temp = 'a' or $temp = 'b'">...

In 2.0, if you prefer, you can write

<xsl:if test="$temp = ('a', 'b')">





Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #3 (permalink)  
Old June 29th, 2006, 03:29 AM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ramesh.kumarm
Default

thanx a lot man.
It worked out.

Thanx again for your time.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
concat multiple column values into single col sirf_vs Reporting Services 8 May 29th, 2008 09:16 AM
Need to print a string value in a single line simmy_tj BOOK: Beginning Java 2 1 February 13th, 2007 06:36 AM
how to return string value with quotes (single or tllcll BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 3 November 10th, 2005 01:57 PM
How to store single value in variable? sacred21 Classic ASP Basics 1 December 29th, 2004 05:25 AM
Trying to send SQL results to a single variable NathanielMc VB Databases Basics 9 June 3rd, 2004 02:36 PM



All times are GMT -4. The time now is 08:23 PM.


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