Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > firefox doesn't like 'disable-output-escaping' setting... looking for alternatives

Reply
Thread Tools

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

 
 
David Henderson
Guest
Posts: n/a
 
      07-27-2007
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>

<td> 21 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>

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

</tr>



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

-David.



 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      07-27-2007
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/
 
Reply With Quote
 
 
 
 
Joseph Kesselman
Guest
Posts: n/a
 
      07-27-2007
Martin Honnen wrote:
> you should simply use literal result elements with attribute value
> templates


Yes. Think in terms of generating XML document structure, ***NOT*** in
terms of generating XML syntax. Trying to force the former by mucking
with the latter is not just a bad idea, it often doesn't work, as this
example demonstrates.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
Reply With Quote
 
Jerinaw Jerinaw is offline
Junior Member
Join Date: Dec 2010
Posts: 1
 
      12-30-2010
Ok so I enclose my html fragments in CDATA so that the xslt parser doesn't parse the html fragments with in my xml. In Chrome I set 'disable-output-escaping' to 'yes' and the cdata elements are not escaped and the html renders correctly.

This is not working in FF since they dont support the 'disable-output-escaping' attribute. Is there a way around this?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JUnit + System.exit(-1): Looking for alternatives Koos Pol Java 9 05-04-2008 03:24 PM
Looking for embeddable Java alternatives =?iso-8859-1?B?bW9vcJk=?= Java 2 12-13-2005 12:10 PM
alternatives to making blocks like { } or other ?? CYBER Python 32 05-25-2004 01:53 PM
alternatives to making blocks like { } or other ?? Michael Chermside Python 1 05-19-2004 04:41 PM
alternatives to making blocks like { } or other ?? Michael Chermside Python 0 05-19-2004 01:08 PM



Advertisments