cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark S. Kent" <>
Subject XSLT/Xalan format-number() issue:
Date Wed, 21 Nov 2001 20:14:51 GMT
Excuse this for being a little off topic, but I've asked this on an XSLT
site with no reply (yet) as was hoping someone of Xalan knowledge could
answer it quicker from here.

If not, how do I look at the format-number() source of Xalan to see what
it's doing?  Is it in the "xalan-2.2.0-dev.jar" file?  If so, how do I
decompile that?

I use:
  Windows NT
  Tomcat 4.0.1
  Cocoon2 rc2


------- message --------
I'm having trouble supressing the default "minus sign" ("-") on negative
format-number() operations.  I know you can specify a postive pattern and
an optional negative pattern.  I have to display an "h:mm" time format for
an integer minute value and I want the result to look like:
  +h:mm   for positive values
  -h:mm   for negative values

This "h:mm" format needs to ensure:
  - a leading "+" for positive numbers or "-" for negative numbers
  - no decimals in the "h" or "mm" results
  - no leading zero on "h" (this is ok by default)
  - a leading zero on "mm" (if needed - so "5" would display as "05")

This is what I have:
<xsl:value-of select="concat( format-number( $diff div 60, '+0;-0' ), ':',
format-number( $diff mod 60, '00;00' ) )"/>

This will take the "absolute value" of the "h" portion (kind-of) and
prefix it with a "+" or "-".

The problem is with the "mm" portion:  I tried specifying an
optional "negative" format of "00" so that it would not try to put a
the "minus" sign, but it is showing "-6:-30".  If ANY other character is
added to the optional negative pattern, it will work.
i.e. this will show the negative value with parentheses:
<xsl:value-of select="concat( format-number( $diff div 60, '+0;(0' ), ':',
format-number( $diff mod 60, '00;00)' ) )"/>
will show "(6:30)" -- but that's not what I need.

Any reason why the negative pattern is not being used?  Is it because it
is a duplication of the positive pattern?


Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message