Question : problems with html embedded content in xml files

First thank you for your time.

I am having difficulty translating and ultimately displaying xml nodes with embedded html content.  Here is my xml fragment:

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="Testimonials.xslt"?>

<Contacts>
  <Contact>
    <Description>Line 1 description&lt;br /&gt;Line 2 description</Description>
  </Contact>
<Contacts>

In my xsl file, I want to do something like this:

<xsl:template match="//Contacts">
      <xsl:for-each select="//Contactl">

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

      </xsl:for-each>
</xsl:template>

I have tried "yes" and "no" for the disable-output-escaping value and in both cases it displays:
    Line 1 description<br />Line 2 description

I want it to display:
Line 1 description
Line 2 description.

What do I need to do to fix this problem?

By the way, if I change the xml file and replace "&lt;br /&gt;" with "<br />" the same thing is displayed:  
    Line 1 description<br />Line 2 description

Again thank you for your time.

Answer : problems with html embedded content in xml files

The problem you are having is that Firefox doesn't support the "disable-output-escaping" attribute. The reason it works in Internet Explorer is because IE creates a temporary string of your transformed value and then re-parses it as HTML, whereas Firefox doesn't.

If you left your XML as:

  <Contacts>
    <Contact>
      <Description>Line 1 description<br />Line 2 description</Description>
    </Contact>
  <Contacts>

Then replacing xsl:value-of with xsl:copy-of would give you the result you want. Generaly, if you can, then you would want to stick to server-side transformations instead which would mitigate the problem.
Random Solutions  
 
programming4us programming4us