Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

Adding "<![CDATA[" in my xsl


This topic is 4874 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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>

Posted

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.

Posted

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

Posted

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...
Posted

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>

Posted

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

This topic is 4874 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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