[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: RE: [docbook-apps] Aligning numbers in table cells with xsl
Hi Dave, that should work with a straight
forward xsl:choose statement and the XSL functions number(), string-length() and
substring() to convert your string to a double. I.e. something like: <xsl:template name=”StrToNumber”> <xsl:param
name=”str” /> <xsl:choose> <xsl:when
test=”starts-with($str, ‘<’) or starts-with($str, ‘>’)”> <xsl:value-of
select=”number(substring($str, string-length(‘<X’)))”
/> </xsl:when> <xsl:otherwise> <xsl:value-of
select=”number($str)” /> </xsl:otherwise> </xsl:if> </xsl:template> Extensive testing is left
to the reader. J Cheers, Dominik From: Xmplar [mailto:info@xmplar.biz] I managed to (almost) fix the problem by adding a test
for NaN to the string variable: <xsl:if
test="(ancestor-or-self::d:table/@tabstyle = 'numbers' or -- |
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]