Thursday, 28 May 2009
Java 'PUT' for RESTful service
Wednesday, 27 May 2009
Saxon XSLT 2.0 format-number problem (update!)
Symbol Meaning
0 a digit
# a digit, zero shows as absent
. placeholder for decimal separator
, placeholder for grouping separator.
; separates formats.
- default negative prefix.
% multiply by 100 and show as percentage
? multiply by 1000 and show as per mille
¤ currency sign; replaced by currency symbol; if
doubled, replaced by international currency symbol.
If present in a pattern, the monetary decimal separator
is used instead of the decimal separator.
X any other characters can be used in the prefix or suffix
' used to quote special characters in a prefix or suffix.
<numbers>
<test> id="1">1.3</test>
<test> id="2">8E-4</test>
<test> id="3">8E-8</test>
<test> id="4">0.0</test>
<test> id="5">0</test>
</numbers>
and an xslt:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:output method="text"/>
<xsl:template match="numbers">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="test">
<xsl:value-of select="concat('Original: ',text())"/>
Format with #.#####
'<xsl:value-of select="format-number(xs:double(.), '#.#####')"/>'
Format with #.#########
'<xsl:value-of select="format-number(xs:double(.), '#.#########')"/>'
</xsl:template>
</xsl:stylesheet>
But the output is not what one would expect:
Original: 1.3
Format with #.#####
'1.3'
Format with #.#########
'1.3'
Original: 8E-4
Format with #.#####
'.0008'
Format with #.#########
'.0008'
Original: 8E-8
Format with #.#####
''
Format with #.#########
'.00000008'
Original: 0.0
Format with #.#####
''
Format with #.#########
''
Original: 0
Format with #.#####
''
Format with #.#########
''
Tuesday, 26 May 2009
CherryPy Caching: reprise
Friday, 15 May 2009
CherryPy Caching
I just tried turning on CherryPy web caching, this is one of the few things which receives only very cursory treatment in Sylvain Hellegouarch's excellent book, 'CherryPy Essentials'. I managed by incorporating the