February 19, 200520 yr 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
February 19, 200520 yr 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
February 20, 200520 yr 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
February 20, 200520 yr 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
February 20, 200520 yr 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
February 23, 200520 yr 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
February 23, 200520 yr 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> ...
February 23, 200520 yr 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.
Create an account or sign in to comment