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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David Henderson

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

    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="054501022 5" 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?is bn=</xsl:text>

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

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

    <center><xsl:va lue-of select="@defect id"/></center>

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

    </td>

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

    <td><xsl:valu e-of select="@pubDat e"/></td>

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

    </tr>

    </xsl:template>



    The result HTML should look something like this:

    <tr>

    <td><a href="http://localhost/cgi-bin/book_details?is bn=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">&l t;a
    href=&quot;http://localhost/cgi-bin/book_detail...45010225&quot;
    target=&quot;_b lank&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.



  • Martin Honnen

    #2
    Re: firefox doesn't like 'disable-output-escaping' setting... lookingfor alternatives

    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?is bn=</xsl:text>

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

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

    <center><xsl:va lue-of select="@defect id"/></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?is bn={@isbn}"
    target="_blank" ><center><xsl:v alue-of select="@defect id"/></a>

    --

    Martin Honnen

    Comment

    Working...