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.

Adding "<![CDATA[" in my xsl

Featured Replies

Hi,

I am trying to add <![CDATA[ in my xsl but it gives me an error message. Is there a way to add this so i can import chinese characters for my website? Thanks.

Kent

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

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:fmp="http://www.filemaker.com/fmpxmlresult">

<xsl:template match="/">

<xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW">

<book><xsl:text> </xsl:text>

<Field_1> <xsl:text><![CDATA[</xsl:text>

<xsl:value-of select="fmp:COL[1]/fmp:DATA"/> <xsl:text>"!"</xsl:text>

</Field_1><xsl:text>]]</xsl:text><xsl:text> </xsl:text>

<Field_2>

<xsl:value-of select="fmp:COL[2]/fmp:DATA"/>

</Field_2><xsl:text> </xsl:text>

<Field_3>

<xsl:value-of select="fmp:COL[3]/fmp:DATA"/>

</Field_3><xsl:text> </xsl:text>

</book><xsl:text> </xsl:text>

</xsl:for-each>

</xsl:template>

</xsl:stylesheet>

so i can import chinese characters for my website?

Why would this require CDATA?

  • Author

It's for importing chinese character to a joomla extension in a website with the xml. I don't know if i can import without cdata. Thank you for your reply. ^^

cheers,

K.

CDATA is required to preserve text that contains reserved characters such as < or &.

  • Author

Thanks for your reply. I am just wondering that in my case how to add CDATA in the loop if I want to export the data from the filemaker file that may contain special characters. Many thanks.

Kent

I am afraid the request doesn't make much sense to me. Can you provide an example of what is in the exported field, and how should it look in the exported document?

  • 3 weeks later...
  • Author

Hi,

If I want to add CDATA to the attached file, how could I approach it? Many Thanks.

Kent

<xsl:template match="/">

<xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW">

<book><xsl:text> </xsl:text>

<bookid>

<xsl:value-of select="fmp:COL[1]/fmp:DATA"/>

</bookid><xsl:text> </xsl:text>

<title>

<xsl:value-of select="fmp:COL[2]/fmp:DATA"/>

</title><xsl:text> </xsl:text>

<authors>

<xsl:value-of select="fmp:COL[3]/fmp:DATA"/>

</authors><xsl:text> </xsl:text>

<manufacturer>

<xsl:value-of select="fmp:COL[4]/fmp:DATA"/>

</manufacturer><xsl:text> </xsl:text>

<releaseDate>

<xsl:value-of select="fmp:COL[5]/fmp:DATA"/>

</releaseDate><xsl:text> </xsl:text>

<published>

<xsl:value-of select="fmp:COL[6]/fmp:DATA"/>

</published><xsl:text> </xsl:text>

<categs>

<categ>

<xsl:value-of select="fmp:COL[7]/fmp:DATA"/>

</categ>

</categs><xsl:text> </xsl:text>

</book><xsl:text> </xsl:text>

</xsl:for-each>

</xsl:template>

</xsl:stylesheet>

I am afraid this is not moving forward:

Can you provide an example of what is in the exported field, and how should it look in the exported document?

Kent, at first glance your code seems incorrect (especially as this is not valid placement of the delimiters for CDATA):

<Field_1> <xsl:text><![CDATA[</xsl:text>

<xsl:value-of select="fmp:COL[1]/fmp:DATA"/> <xsl:text>"!"</xsl:text>

</Field_1><xsl:text>]]</xsl:text><xsl:text> </xsl:text>

this is UNTESTED (by me):


<Field_1><xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text><xsl:value-of select="fmp:COL[1]/fmp:DATA" /><xsl:text disable-output-escaping="yes">]]></xsl:text></Field_1>

You have to 'disable-output-escaping' to allow the "<" or ">" in the 'text'.

And comment may be correct. If you need to use the character in FMP exported to your website, won't they just "go"? or do you need to specify UTF-16 or something? What error message are you getting?

Did you try to use the xml without using CDATA?

Do you get an error message from FMP or the website (or both)?

Beverly

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.