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 | Calendar | 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 April 28th, 2006, 07:25 AM
Authorized User
 
Join Date: Apr 2006
Location: , , United Kingdom.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Comparing two strings

I have to strings, each variables ($correctAnswer & $userAnswersAll).

They are both of 225 character length. I can output their string values and string-length. But when I try to compare them together all hell breaks loose.

If even tried comapring the string lengths against each other, still no luck:
<xsl:if test="string-length($correctAnswer) = string-length($userAnswersAll)">
    <b>Well done. All correct!!!</b>
</xsl:if>

Any help in this area would be greatly appreciated. Thanks.

See:
http://storm-cloud.cs.cse.dmu.ac.uk:...sql/index.xsql
(Debug off, press check under puzzle. Puzzle contains correct values for testing purposes).
Reply With Quote
  #2 (permalink)  
Old April 28th, 2006, 07:36 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

Sorry, but I doubt that "all hell breaks loose" is a particularly precise description of the symptoms you are seeing. It's certainly not good enough to diagnose the problem.

Usually when someone submits three lines of code and says they don't work, it's because the problem is somewhere else. (As my grandmother used to say, if you can't find something it's usually because you're looking in the wrong place).

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #3 (permalink)  
Old April 28th, 2006, 08:10 AM
Authorized User
 
Join Date: Apr 2006
Location: , , United Kingdom.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I apologise. 'All hell breaks loose' was a bit over the top! :)

Just realised i set the variable to the wrong value. My bad. Sorry 4 wasting your time (& mine) grrrr!

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
comparing strings and integers pcase XSLT 2 December 1st, 2007 06:55 AM
comparing strings seymour_glass C# 5 February 6th, 2007 04:49 PM
Comparing Arrays mattastic Javascript 2 January 27th, 2006 05:48 AM
comparing strings treasacrowe Classic ASP Databases 5 September 11th, 2004 09:48 AM
Comparing DataSets. jitu ADO.NET 1 June 7th, 2004 11:18 AM



All times are GMT -4. The time now is 12:03 AM.


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