Spidey Posted September 1, 2011 Posted September 1, 2011 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>
comment Posted September 1, 2011 Posted September 1, 2011 so i can import chinese characters for my website? Why would this require CDATA?
Spidey Posted September 2, 2011 Author Posted September 2, 2011 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.
comment Posted September 2, 2011 Posted September 2, 2011 CDATA is required to preserve text that contains reserved characters such as < or &.
Spidey Posted September 8, 2011 Author Posted September 8, 2011 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
comment Posted September 8, 2011 Posted September 8, 2011 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?
Spidey Posted September 24, 2011 Author Posted September 24, 2011 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>
comment Posted September 24, 2011 Posted September 24, 2011 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?
beverly Posted September 27, 2011 Posted September 27, 2011 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now