By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,364 Members | 1,272 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,364 IT Pros & Developers. It's quick & easy.

firefox doesn't like 'disable-output-escaping' setting... looking for alternatives

P: n/a
I know 'disable-output-escaping' has been discussed in the past, but I can't
put my finger on any of the threads to see if my current problem is
addressed. Sorry for re-asking the question if it has already been
answered...

I have an XML doc that I am transforming via XSLT and JavaScript in the
browser. This allows me to return unsorted data to the browser and allow
the user to sort it with a mouseclick and not hit the server just to perform
the same query with a new sortby clause. My XSLT works fine in Internet
Explorer, but FireFox doesn't seem to respect the 'disable-output-escaping'
attribute like I'd expect. The result is that the output HTML includes <
and " instead of valid HTML.

Here's a fragment of the XML:

<Book isbn="0545010225" author="Rowling, J. K.;" pubDate="21 July 2007">
Harry Potter and the Deathly Hallows
</Book>

Here's the XSLT fragment that transforms it to HTML:

<xsl:template match="Book">

<tr>

<td class="link">

<xsl:text disable-output-escaping="yes">&lt;a
href=&quot;http://localhost/cgi-bin/book_details?isbn=</xsl:text>

<xsl:value-of select="@isbn"/>

<xsl:text disable-output-escaping="yes">&quot; target=&quot;_blank&quot;
&gt;</xsl:text>

<center><xsl:value-of select="@defectid"/></center>

<xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>

</td>

<td><xsl:value-of select="@author"/></td>

<td><xsl:value-of select="@pubDate"/></td>

<td><xsl:value-of select="."/></td>

</tr>

</xsl:template>

The result HTML should look something like this:

<tr>

<td><a href="http://localhost/cgi-bin/book_details?isbn=0545010225" target="_blank"
>0545010225</a></td>
<td>Rowling, J. K.;</td>

<td21 July 2007</td>
<td>Harry Potter and the Deathly Hallows</td>

</tr>

In FireFox, the 'disable-output-escaping="yes"' is being ignored, so I end
up with:

<tr>

<td class="link">&lt;a
href=&quot;http://localhost/cgi-bin/book_detail...45010225&quot;
target=&quot;_blank&quot; &gt;0545010225&lt;/a&gt</td>

<td>Rowling, J. K.;</td>

<td21 July 2007</td>
<td>Harry Potter and the Deathly Hallows</td>

</tr>

.. not quite what I was going for. Anyone have a suggestion?

-David.

Jul 27 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
David Henderson wrote:
I have an XML doc that I am transforming via XSLT and JavaScript in the
browser. This allows me to return unsorted data to the browser and allow
the user to sort it with a mouseclick and not hit the server just to perform
the same query with a new sortby clause. My XSLT works fine in Internet
Explorer, but FireFox doesn't seem to respect the 'disable-output-escaping'
attribute like I'd expect. The result is that the output HTML includes &lt;
and &quot; instead of valid HTML.
disable-output-escaping is an optional feature only supported when the
XSLT processor serializes the result tree. Firefox does not serialize at
all so it does not support disable-output-escaping.

Instead of

<xsl:text disable-output-escaping="yes">&lt;a
href=&quot;http://localhost/cgi-bin/book_details?isbn=</xsl:text>

<xsl:value-of select="@isbn"/>

<xsl:text disable-output-escaping="yes">&quot; target=&quot;_blank&quot;
&gt;</xsl:text>

<center><xsl:value-of select="@defectid"/></center>

<xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>

you should simply use literal result elements with attribute value
templates e.g.

<a href="http://localhost/cgi-bin/book_details?isbn={@isbn}"
target="_blank"><center><xsl:value-of select="@defectid"/></a>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 27 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.