Re: [xsl] include html in xsl

Subject: Re: [xsl] include html in xsl
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 09 Apr 2006 09:02:50 -0400
At 2006-04-08 12:26 +0530, Mygrp wrote:
havent tried cdata.
im using something like this:

<xsl:copy-of select="document('/home/khel/scoresphp/iscore/html/topnav.html')"/>
can i enclose the above in the cdata section?

The XSLT 1.0 document() function will not accept HTML as an input ... only XML, but it looks from your next post that you've solved that issue.


At 2006-04-09 09:15 +0530, Mygrp wrote:
I tried embedding the html in cdata section, but the result is the
html is html is not interpreted and is displayed as text!!

Yes, because you are just emitting angle brackets, you aren't emitting markup.


This is the use case for disable-output-escaping ... when you have XML wrapping HTML (whether or not the HTML is in a CDATA, however it is in there must be well formed or you wouldn't have XML) you need to have the result serialized as markup, not as text:

If your input were:

  <doc>
   <![CDATA[<html><body><p>Hello</p></body></html>]]>
  </doc>

You would use:

<xsl:value-of select="doc" disable-output-escaping="yes"/>

I hope this helps.

. . . . . . . . . . Ken


-- Registration open for XSLT/XSL-FO training: Wash.,DC 2006-06-12/16 Also for XML/XSLT/XSL-FO training: Birmingham, UK 2006-05-22/25 World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal

Current Thread
  • [xsl] include html in xsl
    • Mygrp - Sat, 8 Apr 2006 11:40:10 +0530
      • David Adams - Sat, 8 Apr 2006 16:34:15 +1000
        • Mygrp - Sat, 8 Apr 2006 12:26:27 +0530
        • Mygrp - Sun, 9 Apr 2006 09:15:17 +0530
          • Message not available
          • G. Ken Holman - Sun, 09 Apr 2006 09:02:50 -0400 <=