xsl-list
[Top] [All Lists]

[xsl] Outputting Formatted XML within HTML using XSLT

2011-08-31 13:56:02
Hi, folks,

I'm trying to output a block of XML from an XSLT that uses the HTML output 
method for the rest of the page. I figured some combination of xsl:text and 
CDATA section would work, but I must be missing something. The relevant parts 
of the XSLT follow.  This almost is what I want, but I want the XML to be 
displayed with the original formatting. Suggestions much appreciated.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="2.0">
    <xsl:output method="html"/>
{templates outputting HTML table not shown.}
{fragment where XML output is needed:}
                <xsl:text disable-output-escaping="no" 
xml:space="preserve"><![CDATA[
{a bunch of XML nested content here}
                ]]>
                </xsl:text>

For example, if the XML fragment is:

<ELT1 attr1="value">
   <ELT2 attr2="value"/>
   <ELT3 attr3="value" attr4="value"/>
</ELT1>

The above XSLT produces:

<ELT1 attr1="value"><ELT2 attr2="value"/><ELT3 attr3="value" 
attr4="value"/></ELT1>

instead of literally quoting the XML.

Thanks in advance for any help.

Ken Sall
sallk(_at_)saic-dc(_dot_)com
SAIC


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>