Osman Posted February 19, 2005 Posted February 19, 2005 Hi, How can i format my number fields into my desired format. I want to make my number fields with thousand separator as i can make in FileMaker number settings. example raw data : 8527863,45 formatted data : 8.527.863,45 Thanks Adam Djuby
Martin Brändle Posted February 19, 2005 Posted February 19, 2005 For this you need the xsl:decimal-format element ("top-level element") and the XSLT format-number() function. See XSLT 1.0 specification of W3C. After <xsl:stylesheet ...> and before <xsl:template ...>, define a named format: <xsl:decimal-format name="european" decimal-separator="," grouping-separator="."/> For your numbers, use then: <xsl:value-of select="format-number(Xpath-to-your-field-with-number,'#.##0,00','european')"/> Martin
h2o.be Posted February 20, 2005 Posted February 20, 2005 xsl:decimal-format does not work in FileMaker 6 nor filemaker 7
Martin Brändle Posted February 20, 2005 Posted February 20, 2005 Not true! I had tested it before i wrote my post. Works perfectly. This has nothing to do with FM6 or 7, this is a function in Xalan, conforming to the W3C XSLT 1.0 standard. You must use xsl:decimal-format and format-number() in conjunction. Just follow the receipt I have given above. Martin
h2o.be Posted February 20, 2005 Posted February 20, 2005 Not true! I had tested it before i wrote my post. Works perfectly. This has nothing to do with FM6 or 7, this is a function in Xalan, conforming to the W3C XSLT 1.0 standard. You must use xsl:decimal-format and format-number() in conjunction. Just follow the receipt I have given above. I beleve you have test before you have post. I too ! In attachement : my (very simple) xml and xsl doc. When I test it with Oxygen, the number "1234.5" is tranformed to "1.234,50". When I drag and drop the xml document onto the FileMaker Developer 7.0v3 icon, using the xsl doc, the result = "1234.5" and that's not ok. number.zip
Martin Brändle Posted February 20, 2005 Posted February 20, 2005 Ah, I see. So both of us are right. I thought of exporting and web publishing (I tested the functions on a web published database), you of importing. The problem is that the FMPXMLRESULT grammar has no definition for number formats. When the number field is created upon importing, FM just sets it to general formatting and overrides the format specified in the XSLT. Let's Adam decide what he needs really. Martin
cjaeger Posted February 23, 2005 Posted February 23, 2005 FileMaker Inc. deliberately disabled the xsl:number-format in Xalan becaus you can set the Format in FileMaker itself (use format of current layout). So there's no need for the number format function for export. For XML imports, the decimal separator is a problem. See my filemaker2mysql example at FileMaker.com. ... ... -- ' ... I guess the decimal separator from the date-format, then do a translate(',.', '.,'). Any subsequent number-formatting is then applied within fileMaker
cjaeger Posted February 23, 2005 Posted February 23, 2005 oops, wher's the xml gone? next try, now encoded: ... <xsl:template match="fmp:FMPXMLRESULT"> <xsl:variable name="dateformat" select="fmp:DATABASE/@DATEFORMAT" /> ... <xsl:when test="/*/*/fmp:FIELD[$pos]/@TYPE = 'NUMBER'"> <xsl:if test="$dateformat = 'd.M.yyyy'"> <xsl:value-of select="number(translate(fmp:DATA,'.,',',.'))" /> </xsl:if> <xsl:if test="$dateformat = 'M/d/yyyy'"> <xsl:value-of select="number(fmp:DATA)" /> </xsl:if> </xsl:when> ...
Martin Brändle Posted February 23, 2005 Posted February 23, 2005 To clarify: I spoke of FMS7A custom web publishing, I tested an example on my own custom web published databases according to the receipt I gave before, and it works. xsl:decimal-format and the XSLT format-number() function are NOT DISABLED in the Xalan component of FMS7A. Martin Update: "Emotions" removed. Interesting to see that FM Inc. uses different Xalan versions, but clear if one considers all the fmxslt: extension functions built into FMS7A.
Recommended Posts
This topic is 7211 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now