xsl-list
[Top] [All Lists]

[xsl] [XSLT, Version 1] Stylesheet to embed a chunk of XML into HTML?

2006-08-24 09:06:37
Hi Folks,

I am writing a stylesheet which outputs HTML.  My stylesheet pulls in a
chunk of XML from an XML file and then stuffs it within the HTML <body>
element.  Here's what I want my stylesheet to generate:

<html>
    <body> 
        <pre>
             -- XML chunk here (tags not escaped so they will display
in a browser) --
        </pre>
    </body>
</html>

When I drop the resulting HTML into a browser I want the XML chunk to
display, including the tags.  

Below is the XSLT that I thought would work, but doesn't.  Can you show
me the correct way to solve this problem?  

By the way, I am not able to modify the XML file that my stylesheet
reads, so wrapping elements in the XML file within a CDATA section is
not an option for me.

/Roger

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                      version="1.0">

    <xsl:output method="html"/>

    <xsl:template match="/">
      <html>
        <body>
           <xsl:variable name="test">
                <xsl:copy-of select="//Member[1]"/>
           </xsl:variable>
           <pre>
               <xsl:value-of disable-output-escaping="no"
select="$test"/>
           </pre>
        </body>
      </html>
    </xsl:template>
 
</xsl:stylesheet>



--~------------------------------------------------------------------
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>
--~--