Subject: RE: [xsl] comparing a string to a number? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 17 Sep 2003 09:37:48 -0400 |
Yes, '1A' will always be "less than" '20' when compared as strings. String sorting is based on the numeric value (usually ASCII) of each successive character. Thus '10000000' will be "less than" '2'.
-----Original Message----- From: "Keller, Matt" <Keller.Matt@xxxxxxxxxxxxx> Sent: Tue, 16 Sep 2003 17:18:19 -0500 ... <xsl:if test="/Output/response/Field < '20'">
This is confusing to me for a few reasons.
1) The '20' is in quotes
2) the value of the Field node is most often a number, but on some occasions it's a letter/number pair, like 1A or 1B.
Can this check ever work? Would 1A ever be "less" than '20'?
T:\ftemp>type knell.xsl <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/"> <xsl:value-of select="'10000000' < '2'"/> </xsl:template>
</xsl:stylesheet> T:\ftemp>saxon knell.xsl knell.xsl <?xml version="1.0" encoding="utf-8"?>false T:\ftemp>
-- Next public European delivery: 3-day XSLT/2-day XSL-FO 2003-09-22 Next public US delivery: 3-day XSLT/2-day XSL-FO 2003-10-13 Instructor-led on-site corporate, government & user group training for XSLT and XSL-FO world-wide: please contact us for the details
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) ISBN 0-13-065196-6 Definitive XSLT and XPath ISBN 0-13-140374-5 Definitive XSL-FO ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-11-X Practical Formatting Using XSL-FO Member of the XML Guild of Practitioners: http://XMLGuild.info Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] comparing a string to a n, cknell | Thread | RE: [xsl] comparing a string to a n, Niko Matsakis |
RE: [xsl] comparing a string to a n, cknell | Date | RE: [xsl] comparing a string to a n, Niko Matsakis |
Month |