Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xslt number-format mask

Status
Not open for further replies.

progressdll

Programmer
Feb 28, 2002
41
BE
How can i use number-format to turn
this number

9911111222223

into this string

99.11111.22222.3
 
XPath cannot do regexp yet. You can try some substring functions, like substring-before,after and translate...
[red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
you can do
...
<xsl:variable name=&quot;value&quot;>9911111222223
</xsl:variable> <!--if you need to define the number, otherwise select it from the XML -->
...
<xsl:value-of select=&quot;format-number($value, '##.#####.#####.#')&quot;/>

....

just to let you know :)
 
Great Flumpy! I was interested in this as well...
But, how are the parsers coping with that? DO you know anything?

I am writing some stylesheets that should be properly ported across systems, so, for example, is this function available in Saxon, Xalan anso?
[red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
its in the w3.org specs for xslt....


{do a text search for format-number}

so therefore any parser worth its salt should therefore allow the format-number function...

I know MSXML uses it for sure, and I've just used it with xerces.

On second thoughts with regards to the original post's purpose, Im not really sure it was meant to cope with such a large number or that many dots so maybe its not actually what hes looking for. ho hum. may be worth a try, whats to loose? It may be a little more complex than i implied, cause you might need to set up the decimal format for it before you start off. hmm.


matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top