Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. How to use format-number() function?

How to use format-number() function?

Scheduled Pinned Locked Moved XML / XSL
questionhelptutorial
2 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amica
    wrote on last edited by
    #1

    I'm trying to chop the sig digits of numbers. The numbers are accessed at certain levels down the data structure, e.g. /OverallData/Year/Area/../../Value. It causes error if I use format-number(/OverallData/../../../.., ###.##), how do you do it? Also the number can be an attribute of a node. It's a pretty lazy question, but I'm in a hurry to finish off a task, thanks in advance.

    B 1 Reply Last reply
    0
    • A amica

      I'm trying to chop the sig digits of numbers. The numbers are accessed at certain levels down the data structure, e.g. /OverallData/Year/Area/../../Value. It causes error if I use format-number(/OverallData/../../../.., ###.##), how do you do it? Also the number can be an attribute of a node. It's a pretty lazy question, but I'm in a hurry to finish off a task, thanks in advance.

      B Offline
      B Offline
      Bjoern Graf
      wrote on last edited by
      #2

      I never tried it with a full XPath but I think you need to add apostrophs around the format string, e.g.: <xsl:value-of select="format-number(<XPath>,'###.##&apos)" /> Hope this helps, Bjørn.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups