September 1, 201114 yr 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>
September 1, 201114 yr so i can import chinese characters for my website? Why would this require CDATA?
September 2, 201114 yr 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.
September 2, 201114 yr CDATA is required to preserve text that contains reserved characters such as < or &.
September 8, 201114 yr 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
September 8, 201114 yr 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?
September 24, 201114 yr 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>
September 24, 201114 yr 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?
September 27, 201114 yr 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