[Home] [By Thread] [By Date] [Recent Entries]

  • From: "Costello, Roger L." <costello@m...>
  • To: <xml-dev@l...>
  • Date: Fri, 28 Sep 2007 11:20:40 -0400

Thanks David.  

Here's the stylesheet that now works:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                version="2.0">
 
    <xsl:output method="html"/>

    <xsl:template match="x">
        <html>
            <head>
                <title>Treating a Space as an Integer</title>
            </head>
            <body>
                Value * 2 = <xsl:value-of
select="string-to-codepoints(.) * 2" />
            </body>
        </html>
    </xsl:template>

</xsl:stylesheet>

The output is:

Value * 2 = 64

/Roger



-----Original Message-----
From: David Carlisle [mailto:davidc@n...] 
Sent: Friday, September 28, 2007 9:22 AM
To: Costello, Roger L.
Cc: xml-dev@l...
Subject: Re:  [Summary] XML is text-only ... why?


> Am I doing something wrong?

yes, using the function xs:integer to try to get the integer 32 from a
character with unicode value 32. The function you are looking for is
available in xpath but not called xs:integer it is called
string-to-codepoints which returns (in general) a sequence of integers,
but if as here your string has length 1, you'll get a single integer
(32).


David

_______________________________________________________________________
_
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
_______________________________________________________________________
_


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member