One way to handle those characters is to use the translate() function to remove 
them before doing the test.  If the third argument of translate() is empty, 
then the matching characters in the second argument disappear, and all other 
characters are left untouched.  Something like:

string(number(translate(., '<>', '')))


Bob Stayton
Sagehill Enterprises
[email protected]


  ----- Original Message ----- 
  From: Xmplar 
  To: Bob Stayton 
  Cc: DocBook Apps 
  Sent: Thursday, May 24, 2012 7:38 PM
  Subject: Re: [docbook-apps] Aligning numbers in table cells with xsl


  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 
        ancestor-or-self::d:table/@tabstyle = 'numberstripe') and 
not(ancestor::d:thead or
        ancestor::d:tfoot) and preceding-sibling::d:entry and (string(number(.) 
!= 'NaN'))">

  This however will not select any cells that have a number and a non-numeric 
string (such as greater than or less than signs: <1, or >20) - my test treats 
those cells as a string and not as a number. I now need to find how to convert 
&lt; and &gt; to a number so that the test selects cells with a number and a lt 
or gt sign.

  On 24-05-12 4:24 PM, Bob Stayton wrote: 
    <xsl:if test="(ancestor-or-self::d:table/@tabstyle = 'numbers' or 
          ancestor-or-self::d:table/@tabstyle = 'numberstripe') and 
not(ancestor::d:thead or
          ancestor::d:tfoot) and preceding-sibling::d:entry and 
string(number(.))">


  -- 
  Dave Gardiner
  Xmplar
  [email protected]
  http://xmplar.biz
  Mob. 0416 833 993

Reply via email to