You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Peter (JIRA)" <ji...@apache.org> on 2013/01/02 10:40:12 UTC

[jira] [Commented] (XALANJ-2565) java.lang.RuntimeException: ElemTemplateElement error: Malformed format string

    [ https://issues.apache.org/jira/browse/XALANJ-2565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13542065#comment-13542065 ] 

Peter commented on XALANJ-2565:
-------------------------------

Hi, I have the exactly same bug. My requirement is to have the same decimal-format:

<xsl:decimal-format decimal-separator="," grouping-separator="."/>

and the following format-number

<xsl:value-of select="format-number(66666.66, '#,##0.00')"/>

required output: 66.666,66

Is there a workaround available to reach this requirement?
                
>  java.lang.RuntimeException: ElemTemplateElement error: Malformed format string
> -------------------------------------------------------------------------------
>
>                 Key: XALANJ-2565
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2565
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects.  Anybody can view the issue.) 
>          Components: Xalan
>    Affects Versions: 2.7.1
>         Environment: Java 1.6.37 + Glassfish 3.0.1 + Xalan 2.7.1
>            Reporter: alebor
>            Assignee: Steven J. Hathaway
>             Fix For: 2.7.1
>
>         Attachments: XALANJ-2565.zip
>
>
> Setting decimal format decimal/grouping separators causes runtime exception. It looks like when "'#,###.###" pattern is used, you are not allowed to use "." for grouping separator and "," for decimal separator while from format-number documentation this should be possible since "," and "." specify the POSITION of the separators. 
> Documentation: 
> ===========
> string format-number(number,format,[decimalformat]) 
> number 	Required. Specifies the number to be formatted
> format 	Required. Specifies the format pattern. Here are some of the characters used in the formatting pattern:
>     0 (Digit)
>     # (Digit, zero shows as absent)
>     . (The position of the decimal point Example: ###.##)
>     , (The group separator for thousands. Example: ###,###.##)
>     % (Displays the number as a percentage. Example: ##%)
>     ; (Pattern separator. The first pattern will be used for positive numbers and the second for negative numbers)
> decimalformat 	Optional.
> EXCEPTION:
> =========
> SEVERE: SystemId Unknown; Line #57; Column #73; java.lang.RuntimeException: ElemTemplateElement error: Malformed format string: #,###.###
> Example: 
> ======
> 	<xsl:output method="text" encoding="iso-8859-1"/>	
> 	<!-- This format has no name, so it's assumed to be the default. -->
> 	<xsl:decimal-format decimal-separator="," grouping-separator="."/>
>         <xsl:if test="./@actualValue">
> 	    <xsl:value-of select="format-number(./@actualValue, '#,###.###')"/>
>         </xsl:if>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xalan.apache.org
For additional commands, e-mail: dev-help@xalan.apache.org