[thelist] preserving HTML in XSL

Alister Cameron alister at cameron.org
Thu Jan 24 23:26:01 CST 2002


Thanks Eric.

This looks right. What you did here should work but it doesn’t. The error I
get is generated from the XSLISAPI filter... talking about illegal
characters. Dunno where to go from here, coz it’s not working and there’s
nothing wrong with the XML/XSL files.

I suspect I may not have understood one or more limitations of the filter.
Or maybe there’s a namespace issue I still haven’t resolved. I’m just
clueless.

I’ve emailed an MS guru on this... hope he replies. He know the filter
inside-out and back to front, so here’s hoping.

Thanks again.

- Alister.

-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Eric Vitiello
Sent: Friday, 25 January 2002 2:19 AM
To: thelist at lists.evolt.org
Subject: Re: [thelist] preserving HTML in XSL


-- Alister Cameron [Thu, 24 Jan 2002 23:56:37 +1100]:
>SUMMARY: I am looking for the generic how-to answer for including a
>chunk of pre-prepared HTML in an XML file so that when the XML file is
>transformed into HTML for the client (I'm just working with v4 and up web
browser
>clients here), the HTML slots into the rest of what the xsl
>stylesheet has spat out, all as HTML to be rendered by the browser... no
escaped
>crap!

how about this:


------ XML ------

<?xml version="1.0"?>
<item>
    <title>This is the title</title>
    <content><![CDATA[
        <h1>This is the content</h1>
        and will be displayed with all of the <b>proper formatting</b> that
is placed in this node.
    ]]></content>
</item>

---------------------

-------- XSL -----------
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output encoding="iso-8859-1" method="html" indent="yes"/>
    <xsl:template match="/item">
        <html>
            <head>
                <title><xsl:value-of select="title"/></title>
            </head>
            <body>
                <xsl:value-of select="content"
disable-output-escaping="yes"/>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>
------------------------

I haven;t tested this specific code, but I do this all day long, so it
should work without much headache.

the key is the <![CDATA[ ]]>  block, which tells the XSL not to parse the
data inside, and the disable-output-escaping="yes"  which tells the XSL not
to turn thigns like < into &lt;


---
Eric Vitiello
Perceive Designs
<www.perceive.net>



--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !




More information about the thelist mailing list