Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   rendering properly escaped characters (http://www.velocityreviews.com/forums/t510512-rendering-properly-escaped-characters.html)

bwilcoxis@gmail.com 05-30-2007 06:21 AM

rendering properly escaped characters
 
I have an externally generated xml file that correctly escaping
characters such as apostrophes and quotes and rendering them as
’ and '

the xml file has the following definition:
<?xml version="1.0" encoding="iso-8859-1"?>

I have tried changing that to: <?xml version="1.0" encoding="utf-8"?>
to no avail


I then take the xml file and insert it as an ASP include file via the
following:

<%
Call displayNewsXML5()
Sub displayNewsXML5()
set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.setProperty "ServerHTTPRequest", true
xml.async = false
xml.validateOnParse = true
' Load up the XML newsfeed
xml.load(Server.MapPath("/inc/news/jckgem.xml"))

set xsl = Server.CreateObject("Microsoft.XMLDOM")
xml.setProperty "ServerHTTPRequest", true
xsl.load(Server.MapPath("/inc/news/JCKstyle.xsl"))

' Write the transformation to the browser
Response.Write(xml.transformNode(xsl))
' Cleanup
Set xsl = nothing
Set xml = nothing
End Sub
%>

The xsl file contains the following:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<xsl:for-each select="/rss/channel/item">
<xsl:choose>
<xsl:when expr="childNumber(this) &lt; 2"></xsl:when>
<xsl:when expr="childNumber(this) > 7"></
xsl:when>
<xsl:otherwise>
<p><A>
<xsl:attribute name="HREF">
<xsl:value-of select="link"/>
</xsl:attribute>
<xsl:attribute name="target">_new</xsl:attribute>
<span class="newshead">
<xsl:value-of select="title"/>
</span>
</A>
<BR/>
<span class="news">
<xsl:value-of select="description"/>
</span>
<BR/>
<span class="newsdate">
<xsl:value-of select="pubDate"/>
</span><BR/>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>

</xsl:template>
</xsl:stylesheet>

What do I do to render the escaped characters as ' and " for the user?

Thanks in advance.


usenet@tech-know-ware.com 05-30-2007 08:27 AM

Re: rendering properly escaped characters
 
On 30 May, 07:21, bwilco...@gmail.com wrote:
> I have an externally generated xml file that correctly escaping
> characters such as apostrophes and quotes and rendering them as
> &amp;#8217; and &amp;#39;
>
> the xml file has the following definition:
> <?xml version="1.0" encoding="iso-8859-1"?>
>
> I have tried changing that to: <?xml version="1.0" encoding="utf-8"?>
> to no avail
>
> I then take the xml file and insert it as an ASP include file via the
> following:
>
> <%
> Call displayNewsXML5()
> Sub displayNewsXML5()
> set xml = Server.CreateObject("Microsoft.XMLDOM")
> xml.setProperty "ServerHTTPRequest", true
> xml.async = false
> xml.validateOnParse = true
> ' Load up the XML newsfeed
> xml.load(Server.MapPath("/inc/news/jckgem.xml"))
>
> set xsl = Server.CreateObject("Microsoft.XMLDOM")
> xml.setProperty "ServerHTTPRequest", true
> xsl.load(Server.MapPath("/inc/news/JCKstyle.xsl"))
>
> ' Write the transformation to the browser
> Response.Write(xml.transformNode(xsl))
> ' Cleanup
> Set xsl = nothing
> Set xml = nothing
> End Sub
> %>
>
> The xsl file contains the following:
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
> <xsl:template match="/">
> <xsl:for-each select="/rss/channel/item">
> <xsl:choose>
> <xsl:when expr="childNumber(this) &lt; 2"></xsl:when>
> <xsl:when expr="childNumber(this) > 7"></
> xsl:when>
> <xsl:otherwise>
> <p><A>
> <xsl:attribute name="HREF">
> <xsl:value-of select="link"/>
> </xsl:attribute>
> <xsl:attribute name="target">_new</xsl:attribute>
> <span class="newshead">
> <xsl:value-of select="title"/>
> </span>
> </A>
> <BR/>
> <span class="news">
> <xsl:value-of select="description"/>
> </span>
> <BR/>
> <span class="newsdate">
> <xsl:value-of select="pubDate"/>
> </span><BR/>
> </p>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:for-each>
>
> </xsl:template>
> </xsl:stylesheet>
>
> What do I do to render the escaped characters as ' and " for the user?
>
> Thanks in advance.


I may be mis-understanding what you're saying, but I think the escaped
characters in an XML file should look like:

’ and '

The sequences you've shown are double escaped, and I can't see from
your example why you need that.

HTH,

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML Schema to C++ data binding visit
http://www.codalogic.com/lmx/
=============================================



All times are GMT. The time now is 07:57 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.