Two recommendations:

1. Use XHTML instead of HTML. This isn't hard, and in the long run, worth the
transition. Just keep in mind this, any tag, like a br tag, put a space then a
slash at the end.
<br />
Resaon I say this, is that I've run into a problem with some versions of
netscape having a problem recognizing <br/> as a br tag, so the space, then
slash worked. w3 made the same discovery sometime afterwards and wrote the
notice on their site.

2. Use the xsl:copy-of to retrieve the html tags as values.
--------------------
XML portion:

<Content>
<Body>
<Paragraph>
<big><i>Lorem ipsum dolor sit amet</i></big>, consectetuer adipiscing elit.<br
/> In hac habitasse platea dictumst. 
</Paragraph>
<Paragraph>
<font face="sans-serif">Suspendisse condimentum.</font> Ut fermentum eros nec
justo. 
Ut mi est, tristique quis, convallis et, accumsan vel, mauris. In placerat.
Nunc blandit luctus nibh.
</Paragraph>
</Body>
</Content>

-----------------------
XSL stylesheet portion:

<font size="-1">
  <xsl:for-each select="//Content/Body/Paragraph">
    <p align="left">
      <xsl:copy-of select="."/>
    </p>
  </xsl:for-each>
</font>
-----------------------
Result should be:

<font size="-1">
    <p align="left">
<big><i>Lorem ipsum dolor sit amet</i></big>, consectetuer adipiscing elit.<br
/> In hac habitasse platea dictumst. 
    </p>
<font face="sans-serif">Suspendisse condimentum.</font> Ut fermentum eros nec
justo. 
Ut mi est, tristique quis, convallis et, accumsan vel, mauris. In placerat. 
Nunc blandit luctus nibh.
    <p align="left">
</font>



"James Boulton" <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> Can anyone tell me the best way to include HTML in an XML tag without
> causing parsing problems?
> 
> Something like:
> 
> <item>
> <name>blah</name>
> <desc><font size="2">�10 each</font><br></desc>
> </item>
> 
> Breaks and pound signs are a no-no in XML so... I've tried using a CDATA[]
> section. But this both escapes the data within it and rejects pound signs
> completely as being invalid.
> 
> I could escape the string before outputting into the XML tag, but I would
> then need some way of un-escaping it in XML. Is this a possible approach?
> 
> Any ideas would be much appreciated.
> 
> Ta,
> 
> --Jim


Reply via email to