W3C home > Mailing lists > Public > www-xsl-fo@w3.org > October 2004

Re: Evalution Problems

From: David Carlisle <davidc@nag.co.uk>
Date: Wed, 13 Oct 2004 17:00:53 +0100
Message-Id: <200410131600.RAA13614@penguin.nag.co.uk>
To: Roman.Huditsch@lexisnexis.at
CC: www-xsl-fo@w3.org


This isn't really an FO question (It's XSLT and you don't appear to be
generating XSL FO) so I think you would have been better on xsl-list.

Also your code seemed to be implementing rather more than your stated requirements

  I need to put every string containing numbers into <number> elements.
  If there is a number and a comma appears, it should be trimmed.


It also trims f's and did something with -

however, this is shorter, not sure if it does quite what you want in
practice.

  <xsl:template match="token">
   <xsl:variable name="x" select="translate(.,'f,','')"/>
   <xsl:choose>
    <xsl:when test="number($x)=number($x)">
      <number><xsl:value-of select="$x"/></number>
    <xsl:otherwise>
      <term><xsl:value-of select="."/></term>
    </xsl:otherwise>
  </xsl:choose>
  </xsl:template>


That would decide 123f4 was <number>1234</number> but it depends on how
much control over your input whether such things can happen in practice
and whether you want to check for them in xslt.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
Received on Wednesday, 13 October 2004 16:01:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:13 GMT