Thanks. Got it. I should be able to look into this later today.
Gary
Dave wrote:
>
> A couple little corrections: The example makes more sense if you reverse
> the numeric values in the HighestNumber and Number nodes in the XML. This
> way, the relevant xsl:when test doesn't get triggered when it should. The
> other thing is that in my final example, I should have said <xsl:when
> test="//Number < '2'"> rather than <xsl:when test="//Number<'2'">.
>
> Dave
>
> -----Original Message-----
> From: Dave [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 09, 2001 7:01 PM
> To: [EMAIL PROTECTED]
> Subject: RE: RelationalExpr doing alpha comparisons?
>
> Gary,
>
> Thanks for your response. I'm using Xalan 2.1.0. I'm invoking xalan
> through the JAXP interface in my Java code. Here's the XML and XSLT I'm
> working with. The XSLT is in the simplified stylesheet format:
>
> XML:
> <PrimePowerFactorizations>
> <HighestNumber>100</HighestNumber>
> <Factorization>
> <Number>5</Number>
> </Factorization>
> </PrimePowerFactorizations>
>
> XSLT:
> <html xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0">
> <head>
> <title>Prime Power Factorizations</title>
> </head>
> <body>
> <xsl:choose>
> <xsl:when test="//Factor">
> <p><xsl:value-of select="//Number"/> =
> <xsl:for-each select="//Factor">
> <xsl:value-of select="Base"/>^<xsl:value-of
>select="Exponent"/>
> <xsl:if test="position()!=last()">*</xsl:if>
> </xsl:for-each></p>
> </xsl:when>
> <xsl:when test="//Number=0">
> </xsl:when>
> <xsl:when test="//Number=1">
> <p>Please enter a positive integer greater than one.</p>
> </xsl:when>
> <xsl:when test="//Number > //HighestNumber">
> <p>This program is currently generating the numbers from
> <xsl:value-of select="//HighestNumber + 1"/> to
> <xsl:value-of select="//Number"/>. Return to this
> page to see the highest number factored.</p>
> </xsl:when>
> </xsl:choose>
>
> <p>The highest number factored by this program so far is <xsl:value-of
> select="//HighestNumber"/>.</p>
>
> <form method="POST"
> action="http://localhost:8080/primes/servlet/PrimeServlet">
> <p>Enter a number you would like a prime power factorization for:
> <input type="text" name="Number" size="29"/>
> <input type="submit" value="Submit/Refresh" name="Submit"/>
> </p>
> </form>
> </body>
> </html>
>
> Again, the element that shows this issue is:
> <xsl:when test="//Number > //HighestNumber">,
> whereas <xsl:when test="number(//Number) > //HighestNumber">
> produces the correct result.
>
> The same result can be produced when specifying a number as a string as in:
> <xsl:when test="//Number<'2'">
>
> Please let me know what you figure out.
> Dave
>
> -----Original Message-----
> From: Gary L Peskin [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 09, 2001 5:25 PM
> To: [EMAIL PROTECTED]
> Subject: Re: RelationalExpr doing alpha comparisons?
>
> Dave --
>
> I think that Michael Kay is correct on this. It may be a bug in Xalan.
> What version of Xalan are you using and can you supply working XML and
> XSLT examples that will allow us to reproduce the problem?
>
> Gary
>
> Dave wrote:
> >
> > According to Michael Kay, a relational comparison doesn't compare strings,
> > but converts strings to numbers if possible and compares numeric values.
> >
> > When for example this element is evaluated by Xalan in my stylesheet:
> >
> > <xsl:when test="//Number > //HighestNumber">
> >
> > where number and highest number contain numbers.
> >
> > It seems to compare the two nodes as strings, so for example, 5 is
> > considered greater than 100. This seems contradictory to Kay's
> statements.
> >
> > It worked when I replaced the previous element with:
> >
> > <xsl:when test="number(//Number) > //HighestNumber">.
> >
> > I'm just bothered that it didn't behave the way I thought it should. Of
> > course I'm just a beginner at all this. Is this a problem with Xalan,
> > Michael Kay, or me?
> >
> > Thanks,
> > Dave Kaplan