rendering properly escaped characters

Discussion in 'XML' started by bwilcoxis@gmail.com, May 30, 2007.

  1. Guest

    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:eek:therwise>
    <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:eek:therwise>
    </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.
     
    , May 30, 2007
    #1
    1. Advertising

  2. Guest

    On 30 May, 07:21, 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:eek:therwise>
    > <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:eek:therwise>
    > </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/
    =============================================
     
    , May 30, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    818
  2. Ben Finney
    Replies:
    2
    Views:
    351
    Josiah Carlson
    Apr 3, 2004
  3. Henrik S. Hansen

    Translating escaped characters

    Henrik S. Hansen, Nov 1, 2004, in forum: Python
    Replies:
    2
    Views:
    305
    Henrik S. Hansen
    Nov 2, 2004
  4. Derek Basch
    Replies:
    2
    Views:
    477
    Derek Basch
    Mar 25, 2005
  5. Thea
    Replies:
    2
    Views:
    645
Loading...

Share This Page