[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Displaying document( ) output within CDATA
On Wed, Jun 27, 2001 at 09:05:17PM -0700, Mark Miller wrote: > Any suggestions on how to insert code from an external > file into a CDATA section would be appreciated. If you want to emit a <![CDATA[ ... ]]> section on output, you probably want to look at <xsl:output cdata-section-elements=""/>. This will make the child text content of an element appear within a CDATA section. You can hack CDATA sections by hand to appear in the middle of a stream of text nodes, but it involves hacking around the output escaping of < and >. In your case, if you want to show examples as-is, as they are found in an external XML file (or XML fragment), you probably want to use <xsl:copy-of select=document()"/> Here's a stylesheet fragment that may help you get going. <xsl:output method="xml" cdata-section-elements="example"/> <xsl:template match="example"> <example> <xsl:copy-of select="document(@href)"/> </example> </xsl:template> That will select the document specified by <example href=""/> in your source, and display it as <example><![CDATA[ ... ]]></example> in your output. Hope this helps, Z. 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
|