Jump to content

Disable Output Escaping - Firefox


rlbewick

Recommended Posts

Is the a workaround to the "Disable Output Escaping='yes'" for Gecko based browsers such as Firefox? I know that Firefox does not support this feature while IE does support it. What are some possible solutions to this issue? Javascript, PHP, DOCTYPE, CDATA ?? Please provide code if you can.I search and I search to no end but, no workable solutions as of yet..

Link to comment
Share on other sites

I don't think there is a general workaround. The only approach in some cases is to avoid the need to use disable-output-escaping by changing the input format, for instance if you want to use it to output HTML fragments you have stored as escaped markup the workaround is to change the input to store wellf-formed XHTML fragments as nodes you can then process with XSLT without the need for disable-output-escaping. So instead of having e.g.

<content><![CDATA[<p class=c1>Whatever.<p>Whatelse.]]></content>

as the input and doing e.g.

<xsl:template match="content">  <xsl:value-of select="." disable-output-escaping="yes"/></xsl:template>

in the stylesheet you would change the input to e.g.

<content><p class="c1">Whatever.</p><p>Whatelse.</p></content>

and then use e.g.

<xsl:template match="content">  <xsl:copy-of select="node()"/></xsl:template>

in your stylesheet.

Link to comment
Share on other sites

I don't think there is a general workaround. The only approach in some cases is to avoid the need to use disable-output-escaping by changing the input format, for instance if you want to use it to output HTML fragments you have stored as escaped markup the workaround is to change the input to store wellf-formed XHTML fragments as nodes you can then process with XSLT without the need for disable-output-escaping. So instead of having e.g.
<content><![CDATA[<p class=c1>Whatever.<p>Whatelse.]]></content>

as the input and doing e.g.

<xsl:template match="content">  <xsl:value-of select="." disable-output-escaping="yes"/></xsl:template>

in the stylesheet you would change the input to e.g.

<content><p class="c1">Whatever.</p><p>Whatelse.</p></content>

and then use e.g.

<xsl:template match="content">  <xsl:copy-of select="node()"/></xsl:template>

in your stylesheet.

Thank you Martin, I think this is what I am looking for but do not quite understand how to implement it. My XML file has HTML tags inside of the text that I would like to display and have those tags functional. I currently do not use a CDATA section. I guess I do not understand how to create a template within a template, if I am thinking correctly. Or call a template match to <content></content> from within another template match. I hope I am making some since. I need to select specific data by [OfferId=Some Number], see the following code for an example.XML:
<OfferDetails>				<OfferId>56</OfferId>									<Offername>Blue from American Express(R)</Offername>									<SmallCreative>http://img1.44e9-a59e-0a69c086592d.gif									</SmallCreative>									<BigCreative>http://img1.9-4057-8d99-9d50209afa65.jpg									</BigCreative>									<OfferTextdetails><ul><li>0% Intro APR for 6 months on purchases</li><li>No Annual Fee</li><li>Earn Membership Rewards(R) points for your everyday purchases, and enjoy fast and easy ways to earn and redeem so you can get the rewards you want now</li><li>Express Approval.  Get a decision in less than 60 seconds.</li></ul>									</OfferTextdetails>

XSL:

<xsl:for-each select="$XML">						<xsl:for-each select="AffiliateAccountOffers">							<xsl:for-each select="OfferDetails">								<xsl:value-of select="OfferTextdetails[../OfferId='56']" disable-output-escaping="yes"/>							</xsl:for-each>						</xsl:for-each>					</xsl:for-each>

Link to comment
Share on other sites

You have posted a small snippet of XML that is not even well-formed and in particular you have not shown us the HTML you want to create with the transformation. Assuming you want to output the HTML elements (e.g. ul, li) in the OfferTextdetails elements) you could simply do e.g.

<xsl:template match="OfferDetails[OfferId = 56]/OfferTextdetails">   <xsl:copy-of select="node()"/></xsl:template>

Link to comment
Share on other sites

You have posted a small snippet of XML that is not even well-formed and in particular you have not shown us the HTML you want to create with the transformation. Assuming you want to output the HTML elements (e.g. ul, li) in the OfferTextdetails elements) you could simply do e.g.
<xsl:template match="OfferDetails[OfferId = 56]/OfferTextdetails">   <xsl:copy-of select="node()"/></xsl:template>

Copy-of select produces the same output in Firefox and IE displaying the code which is not desired. I have since moved on to a PHP script that parses the XML to a MySql database. This takes care of the problem.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...