[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Displaying document( ) output within CDATA

Subject: Re: Displaying document( ) output within CDATA
From: Adam Turoff <ziggy@xxxxxxxxx>
Date: Thu, 28 Jun 2001 14:39:51 -0400
displaying 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.