Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > rendering properly escaped characters

Reply
Thread Tools

rendering properly escaped characters

 
 
bwilcoxis@gmail.com
Guest
Posts: n/a
 
      05-30-2007
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 xmlnssl="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>
<xsltherwise>
<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>
</xsltherwise>
</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.

 
Reply With Quote
 
 
 
 
usenet@tech-know-ware.com
Guest
Posts: n/a
 
      05-30-2007
On 30 May, 07:21, (E-Mail Removed) 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 xmlnssl="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>
> <xsltherwise>
> <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>
> </xsltherwise>
> </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/
=============================================

 
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
servlet request handling - escaped characters in request Thea Java 2 09-22-2006 12:08 PM
Convert Raw Text Escaped Characters to Characters nicholas.wakefield@gmail.com Java 2 07-11-2005 09:17 PM
Minidom output of XML escaped characters Derek Basch Python 2 03-25-2005 05:25 PM
Translating escaped characters Henrik S. Hansen Python 2 11-02-2004 07:12 AM
Translate escaped characters in a string Ben Finney Python 2 04-03-2004 07:46 AM



Advertisments