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

Outputting Formatted XML within HTML using XSLT

Subject: Outputting Formatted XML within HTML using XSLT
From: "Sall, Kenneth" <SallK@xxxxxxxxxxx>
Date: Wed, 31 Aug 2011 18:54:06 +0000
 Outputting Formatted XML within HTML using XSLT
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@xxxxxxxxxxx
SAIC

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.