[thelist] [XSLT/PHP] problems outputting HTML embedded within an XML doc

Jacques Capesius jacques_capesius at cnt.com
Mon Jul 14 13:20:29 CDT 2003


Hi folks,

I'm trying to embed HTML tags within an XML document, and then transform the
document to html using XSL. The problem I'm having is that during the
transformation, the html tags in the XML document are getting stripped out,
and I don't want this to happen.

For example,

the following XML document....

---------------------------------------------
<?xml version='1.0'?>
<page>
  <content>
  <p>1st paragraph</p>
  <p>
    2nd paragraph
    <ul>
          <li>1st item</li>
     <li>2nd item</li>
        </ul>
  </p>
  </content>
</page>

---------------------------------------------
...when transformed by the following XSL template...

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="no" encoding="ISO-8859-1" />

  <xsl:template match="page">
    <xsl:value-of select="content" />
  </xsl:template>

</xsl:stylesheet>

---------------------------------------------
...the html output is this:


  1st paragraph
  
    2nd paragraph
    
     1st item
     2nd item

-----------------------------------------------
...what I want it to output is this:

<p>1st paragraph</p>
  <p>
    2nd paragraph
    <ul>
     <li>1st item</li>
     <li>2nd item</li>
    </ul>
  </p>

is there anything I can do within XSL that will prevent the html tags from
being stripped out?
is there something I can do within PHP to accomplish same?
to transform the doc, I'm using..

$xp = xslt_create();
$result = @xslt_process($xp, $xml, $xsl);
echo $result;
xslt_free($xp);

TIA for any help you can give


More information about the thelist mailing list