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.

Line Breaks in Fields

Featured Replies

Hi all

I have almost successfully moved my CDML pages to XSL, but I am still unable to get paragraph breaks in my fields. Do I have to use a substitute calculation or can I do it directly in the XSL page.

Any clues would be greatly appreciated.

TIA

Stephen

There is a fmxslt extension function for this described on page 64 of the FMS7A Custom Web Publishing Guide.

Try:

<xsl:value-of select="fmxslt:break_encode(XPath_to_your_field)" disable-output-escaping="yes"/>

e.g. where you have

<xsl:value-of select="XPath_to_your_field"/>, wrap the fmxslt:break_encode() function around it and add the attribute disable-output-escaping="yes"

In addition, you should add as namespace definition

xmlns:fmxslt="xalan://com.fmi.xslt.ExtensionFunctions"

to your <xsl:stylesheet ...> tag at the very top of your page, if not already done so.

  • Author

Thanks Martin

That was exactly what I needed. One other quick one ... if I have used quotes ie. ' or " in the text field, they are appearing as ? (question marks) ... how can I avoid this?

Thanks again for your assistance. It is greatly appreciated.

Stephen

Do you use "smart" quotes in the field? (That's some FM setting in document preferences).

Maybe you try to following:

Change your first line in the XSLT file to

<?xml version="1.0" encoding="UTF-8"?>

and

<xsl:output ...> to <xsl:output method="html" encoding="UTF-8"/>

and remove the

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> tag.

The transformation of the stylesheet then produces Unicode-8 format, a format that modern browsers should be able to interpret. Then these smart quotes that are not part of the ASCII char set should be output as Unicode chars. At least I hope so, if I have understood the disable-output-escaping="yes" attribute correctly.

  • Author

Once again. Thanks Martin. I have my pages working perfectly.

Regards

S

The fmxslt extension functions are available in FMS7A only.

If you need to encode your line breaks with FM6, you should follow along this receipt.

Once again, thanks a ton, Martin. This works exactly as wanted.

I had tried to do a more complicated version of this very technique, but it failed because I was using & # 1 3 ; instead of & # x A ; . Substituting the new hex code for my original one, the function I wrote works. Do you know of a list of preferred XML hex codes? I had gotten & # 1 3 ; from what I believe to be a good source for HTML codes.

J

Something like this hex-decimal/decimal-hex calculator ?

Just type in A , hex --> dez yields 10

Type in 13 , dez --> hex yields D

& x D ; = & # 1 3 ;

& # 10 ; = & x A ;

See also these charts of Unicode values if you need some special characters.

Martin, that Unicode reference is great! I guess I will have to trap for xA and xD, as it seems a line break could be either one of those.

J

  • 1 month later...

I know this doesn't happen, but this seems to have broken all on its own. The issue I am having is apparently [space] is getting confused with & # x A ; somehow.

When I view the XSLT in a text editor, I have the text & # x A ; in the appropriate place; but when I view it in my chosen XML editor (XMLShell), it changes to a carriage return (the line actually feeds immediately before where I would expect to see & # x A ;). And then when I import into FileMaker using this XSLT, I find that the string I intended to substitute for & # x A ; is being substituted for [space], but not for the newline, which is (of course) what I want.

I'm guessing there is some argument I need to use to avoid this, but I don't know where. Odd thing is, it was working until recently, and I'm sure that I didn't change anything!

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.