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 April 28th, 2006, 07:25 AM
Authorized User
 
Join Date: Apr 2006
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).
 
Old April 28th, 2006, 07:36 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
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
 
Old April 28th, 2006, 08:10 AM
Authorized User
 
Join Date: Apr 2006
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!






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





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