Re: [xsl] outputting CDATA section

Subject: Re: [xsl] outputting CDATA section
From: "Mike Haarman" <mhaarman@xxxxxxxxxxxxxxxxxx>
Date: Tue, 22 Apr 2003 12:19:28 -0500
From: "Nathan Shaw" <n8_shaw@xxxxxxxxx>

> I am trying to transform xml to xml and the end schema
> dictates that I have to put all of my actual content
> (HTML page) into an element like this:
>
> <property name="body"><[[CDATA[ potentially nasty,
> ill-formed HTML ]]></property>
>

  <xsl:template match="content">
    <xsl:element name="property">
      <xsl:attribute name="name">
        <xsl:value-of select="'body'"/>
      </xsl:attribute>
      <xsl:text
disable-output-escaping="yes">&lt;![CDATA[<![CDATA[<html><body><p>Mal-formed
content.</body></html>]]>]]&gt;</xsl:text>
    </xsl:element>
  </xsl:template>


But I don't think it will be possible to get your mal-formed HTML in there
without writing it out just as I have done.  Any construct you might use to
substitute it, a passed parameter or variable assignment, is going to verify
well-formedness of its argument when declared.


hth,

Mike


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread