Re: [xsl] Outputting Formatted XML within HTML using XSLT

Subject: Re: [xsl] Outputting Formatted XML within HTML using XSLT
From: "Christopher R. Maden" <crism@xxxxxxxxx>
Date: Wed, 31 Aug 2011 16:36:29 -0400
On 08/31/2011 02:54 PM, Sall, Kenneth wrote:
> The above XSLT produces:

[...]

> instead of literally quoting the XML.

I donbt believe you. (-:  More politely, the example you posted is not
complete.

crism@portmore:~/tmp$ cat sall.xml
<?xml version="1.0"?>
<root/>

crism@portmore:~/tmp$ cat sall.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="2.0">
  <xsl:output method="html"/>
  <xsl:template match="root">
    <html>
      <head>
        <title/>
      </head>
      <body>
        <p>
          <xsl:text disable-output-escaping="no"
xml:space="preserve"><![CDATA[<foo><bar/><baz/></foo>]]></xsl:text>
        </p>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

crism@portmore:~/tmp$ java net.sf.saxon.Transform -s:sall.xml -xsl:sall.xsl
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title></title>
   </head>
   <body>
      <p>&lt;foo&gt;&lt;bar/&gt;&lt;baz/&gt;&lt;/foo&gt;</p>
   </body>
</html>

BTW, the disable-output-escaping="no" is redundant.

~Chris
--
Chris Maden, text nerd  <URL: http://crism.maden.org/ >
bThe present tendency and drift towards the Police State gives all
 free Americans pause.b b Alabama Supreme Court, 1955
 (Pike v. Southern Bell Tel. & Telegraph, 81 So.2d 254)

Current Thread