Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

thousand separator with xsl

Featured Replies

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

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

  • Author

Thanks.

xsl:decimal-format does not work in FileMaker 6 nor filemaker 7

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

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

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

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

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>

...

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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.