Subject: [xsl] Create CDATA Section in XML Output From: Mark Miller <storefront2000@xxxxxxxxx> Date: Tue, 9 Oct 2001 07:10:56 -0700 (PDT) |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Environment variable, Michael Kay | Thread | Re: [xsl] Create CDATA Section in X, David Carlisle |
Re: [xsl] Overlapping structures, Jörg Heinicke | Date | Re: [xsl] Environment variable, David Carlisle |
Month |