|
|
 |
| 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

June 29th, 2006, 03:38 AM
|
|
Authorized User
|
|
Join Date: Dec 2005
Location: , , .
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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\"
|

June 29th, 2006, 03:48 AM
|
 |
Wrox Author
Points: 12,735, Level: 48 |
|
|
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 3,923
Thanks: 0
Thanked 82 Times in 80 Posts
|
|
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
|

June 29th, 2006, 04:29 AM
|
|
Authorized User
|
|
Join Date: Dec 2005
Location: , , .
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thanx a lot man.
It worked out.
Thanx again for your time.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |