[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Create CDATA Section in XML Output
Greetings, I need to output a CDATA tag in the XML output. I've tried using cdata-section-elements="grammar" as an output attribute, but just get a jumbled mess of CDATA tags. Example: <grammar><![CDATA[ []]><![CDATA[ (]]><![CDATA[mccoy]]><![CDATA[) ]]><![CDATA[ (]]><![CDATA[doc]]><![CDATA[) ]]><![CDATA[ (]]><![CDATA[bones]]><![CDATA[) ]]><![CDATA[] {]]><![CDATA[<]]><![CDATA[question1]]> <![CDATA[ ]]><![CDATA[mccoy]]><![CDATA[>]]><![CDATA[} ]]></grammar> It looks as if every single token is being placed in a seperate CDATA section, instead of one CDATA surrounding the contents of the tag. If I don't use cdata-section-elements="grammar" in the output element, I get the correct output for the grammar tag, but the VoiceXML interpreter won't accept it without the CDATA surrounding. I've tried replacing the opening and closing (lt/gt) symbols with entities, but that didn't work either. I'm using Xerces/Xalan. Any solutions would be greatly appreciated. Thanks, Mark XML INPUT --------- <!-- QUESTION 1 --> <set> <question recording="mccoy-bricklayer.wav"> I'm a doctor, not a bricklayer. </question> <answers> <answer recording="startrek-mccoy-name.wav">mccoy</answer> <answer>doc</answer> <answer>bones</answer> </answers> <hint recording=""> He, supposedly, did not get along with Spock. </hint> </set> DESIRED OUTPUT -------------- ... <grammar> <![CDATA[ [(mccoy) (doc) (bones)] {<question1 mccoy>} ]]> </grammar> ... CURRENT XSLT ------------ <xsl:template match="set"> ... <grammar> [<xsl:apply-templates select="answers/answer"/>] {<<xsl:value-of select="concat('question', position())"/><xsl:text> </xsl:text> <xsl:value-of select="answers"/>>} </grammar> ... </xsl:template> <xsl:template match="answers"> <xsl:apply-templates/> </xsl:template> <xsl:template match="answer"> (<xsl:apply-templates/>)<xsl:text> </xsl:text> </xsl:template> __________________________________________________ Do You Yahoo!? NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|