
March 20th, 2008, 08:29 PM
|
 |
<?php print_f(); ?>
|
|
Join Date: Jul 2004
Location: London
|
|
Mmmmmm no one know how to do this?
I done some more research on this and I came across a few templates that help, but the problem now is, even though the article is displayed in Internet Explorer, it doesn't want to work in FireFox because disable-output-escaping doesn't work on that.
The fix that was meant to work, didn't.
Any help would be much appreciated.
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="articles/article">
<html>
<head>
<InvalidTag type="text/javascript" src="/scripts/disableOutputEscaping.js" />
</head>
<body onload="go_decoding();">
<!-- Fix disable-output-escaping for FireFox -->
<div id="cometestme" style="display:none;">
<xsl:text disable-output-escaping="yes">&</xsl:text>
</div>
<xsl:choose>
<!-- Display insert/update date -->
<xsl:when test="updated_date !='' ">
<p align="right" style="color:#000000;">Updated on <xsl:value-of select="updated_date"/></p>
</xsl:when>
<xsl:otherwise>
<p align="right" style="color:#000000;">Added on <xsl:value-of select="insert_date"/></p>
</xsl:otherwise>
</xsl:choose>
<!-- Display user name -->
<p align="right" style="color:#000000;">By <xsl:value-of select="user/name"/></p>
<!-- Display article body -->
<h1 style="color:#000000;">
<xsl:value-of select="title" disable-output-escaping="yes"/>
</h1>
<h2 style="color:#000000;">
<xsl:value-of select="subtitle" disable-output-escaping="yes"/>
</h2>
<!-- Change invalid chars -->
<xsl:variable name="apos">'</xsl:variable>
<xsl:variable name="value">
<xsl:call-template name="stringreplace">
<xsl:with-param name="stringvalue" select="body"/>
<xsl:with-param name="from" select="'
'"/>
<xsl:with-param name="to" select="'<br/>'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="value2">
<xsl:call-template name="stringreplace">
<xsl:with-param name="stringvalue" select="$value"/>
<xsl:with-param name="from" select="''"/>
<xsl:with-param name="to" select="''"/>
</xsl:call-template>
</xsl:variable>
<div name="decodeable">
<p style="color:#000000;">
<xsl:value-of select="$value2" disable-output-escaping="yes"/>
</p>
</div>
</body>
</html>
</xsl:template>
<!-- String replace function -->
<xsl:template name="stringreplace">
<xsl:param name="stringvalue"/>
<xsl:param name="from"/>
<xsl:param name="to"/>
<xsl:choose>
<xsl:when test="contains($stringvalue, $from)">
<xsl:value-of select="substring-before($stringvalue, $from)" disable-output-escaping="yes"/>
<xsl:if test="contains(substring($stringvalue, 1, string-length($stringvalue) - 1), $from)">
<xsl:value-of select="$to" disable-output-escaping="yes"/>
<xsl:call-template name="stringreplace">
<xsl:with-param name="stringvalue" select="substring-after($stringvalue, $from)"/>
<xsl:with-param name="from" select="$from"/>
<xsl:with-param name="to" select="$to"/>
</xsl:call-template>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$stringvalue" disable-output-escaping="yes"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- NewLines to <br /> -->
<xsl:template name="break">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="contains($text, '
')">
<xsl:value-of select="substring-before($text, '
')" disable-output-escaping="yes"/>
<br />
<xsl:call-template name="break">
<xsl:with-param name="text" select="substring-after($text, '
')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text" disable-output-escaping="yes"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
|