Search

I’m creating a timeshare website and for the sake of the ability to filter down results I have all the prices entered as straight numbers, no commas or anything. What I’m hoping is that XSLT has some method that will allow me to format the number.

I seem to remember there being string manipulators but I can’t find them.

All I need it to do is to be able to know where to insert commas in a number that’s 10,000, 1,000 and when not to insert one, such as anything below 1,000.

Any tips or hints?

I know of the format-number() function natively in XSLT although haven’t used it.

<xsl:value-of select='format-number($number "###,###.00")'/>

Yeah that’s what I use. With the currency value, and allowing for larger numbers, it might look something like this:

<xsl:value-of select="format-number($number,'$#,###,###,###.00')"/>

Worked like a charm! As always thanks for the help!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details