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

Re: [XSLT, Version 1] Stylesheet to embed a chunk of X

Subject: Re: [XSLT, Version 1] Stylesheet to embed a chunk of XML into HTML?
From: "bryan rasmussen" <rasmussen.bryan@xxxxxxxxx>
Date: Thu, 24 Aug 2006 14:16:49 +0200
chunk tag
for example:

<?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:apply-templates select="//Member[1]" mode="code"/>

                </body>
    </html>
  </xsl:template>

<xsl:template match="*" mode="code">
&lt;<xsl:value-of select="name()"/>  <xsl:for-each
select="@*"><xsl:text> </xsl:text><xsl:value-of
select="name()"/>="<xsl:value-of select="."/>"</xsl:for-each>&gt;
<xsl:apply-templates mode="code"/> &lt;/<xsl:value-of
select="name()"/>&gt;
</xsl:template>


something like that above. could be improved a bit.




On 8/24/06, bryan rasmussen <rasmussen.bryan@xxxxxxxxx> wrote:
Well there is the deprecated xmp tag, other than that I think you have
to pretty much escape the elements.

Cheers,
Bryan Rasmussen

On 8/24/06, Costello, Roger L. <costello@xxxxxxxxx> wrote:
> 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>

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.