[xsl] Outputting Formatted XML within HTML using XSLT

Subject: [xsl] Outputting Formatted XML within HTML using XSLT
From: "Sall, Kenneth" <SallK@xxxxxxxxxxx>
Date: Wed, 31 Aug 2011 18:54:06 +0000
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";
    <xsl:output method="html"/>
{templates outputting HTML table not shown.}
{fragment where XML output is needed:}
                <xsl:text disable-output-escaping="no"
{a bunch of XML nested content here}

For example, if the XML fragment is:

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

The above XSLT produces:

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

instead of literally quoting the XML.

Thanks in advance for any help.

Ken Sall

Current Thread