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

Encapsulating and displaying html fragments

Subject: Encapsulating and displaying html fragments
From: Shaun ONeil <shaun@xxxxxxxxxxx>
Date: Sat, 15 May 2004 05:31:12 -0400
displaying html
Good morning List

I'm a complete beginner, but have tried Google, O'Reilly's "XSLT", the
list archives and dpawson's FAQ - so I hope I'm not treading wrong.

I've found much info on storing special characters / entities, but I
can't figure out how to render them in a document afterwards.

The test case I'm working with can be found (plaintext) at the end of
this mail.

What I'm trying to achieve is to render my xml documents as html, and
have these fragments displayed as part of the document - that is to say,
the markup within the fragments is markup in the rendered page - not
printed as html entities.

I'm not sure how best to word the difference between seeing the markup
on-screen, and rendered as part of the document, so I'll paste examples.

MSIE (6.0) and xsltproc are rendering as I'd hope, ie:

<!DOCTYPE html PUBLIC "-//W3C/DTD HTML 1.0 Strict//EN">
<html><body><p>A <acronym title="HyperText Markup
Language">HTML</acronym> fragment</p></body></html>

and Mozilla (1.7b) and Opera (7.11) are 'breaking', ie:

<!DOCTYPE html PUBLIC "-//W3C/DTD HTML 1.0 Strict//EN">
<html><body>&lt;p&gt;A &lt;acronym title="HyperText Markup
Language"&gt;HTML&lt;/acronym&gt; fragment&lt;/p&gt;</body></html>

So what I ask, is which behaviour is actually correct, and how do I work
around this issue?  My target platform is mozilla, making this a
show-stopper for me right now, so I would be very grateful for any
hints.

TIA,
  Shaun

testcase.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="testcase.xsl"?>
<test>
  <fragment>&lt;p&gt;A &lt;acronym title="HyperText Markup
Language"&gt;HTML&lt;/acronym&gt; fragment&lt;/p&gt;</fragment>
</test>

testcase.xsl:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output
    method="html"
    encoding="utf-8"
    doctype-public="-//W3C/DTD HTML 1.0 Strict//EN"/>
  <xsl:template match="/">
    <html>
      <body>
        <xsl:value-of disable-output-escaping="yes"
select="test/fragment"/>
      </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.