£ sign with xsl

Discussion in 'XML' started by thomas, Oct 29, 2005.

  1. thomas

    thomas Guest

    Anyone know how can I get a £ sign in the cell of a table that has been
    output by an xsl page

    I've tried

    <td>£<xsl:apply-templates select="./price" /></td>
    <td>£<xsl:apply-templates select="./price" /></td>

    both of these give a ? sign instead of a £ sign and the following gives an
    error

    <td>&pound;<xsl:apply-templates select="./price" /></td>

    This is driving me mad?
     
    thomas, Oct 29, 2005
    #1
    1. Advertising

  2. In article <MfA8f.36219$>,
    thomas <> wrote:

    ><td>£<xsl:apply-templates select="./price" /></td>
    ><td>£<xsl:apply-templates select="./price" /></td>


    Both of these are correct.

    >both of these give a ? sign instead of a £ sign


    That sentence appears on my screen with two question marks in it,
    which is a clue to the cause of your problem.

    Most likely, your XSLT processor is outputting the document in one
    encoding, but your HTML viewer is interpreting it in some other
    encoding. If you're looking at it in a browser, try telling it to
    assume a different encoding (UTF-8 for example). Or try telling XSLT
    to output it in Latin-1 by using <xsl:eek:utput encoding="iso-8859-1"/>.

    -- Richard
     
    Richard Tobin, Oct 29, 2005
    #2
    1. Advertising

  3. thomas

    thomas Guest

    If you go to http://www.guitarmidi.co.uk/gui/browse.asp?id=h and view
    source, the following line is in the <head> <META http-equiv="Content-Type"
    content="text/html; charset=UTF-16">. Is this why i'm having problems? I
    take data from the field on index.html and pass them to search.asp, this
    page opens search.xsl

    ******************************************************************
    index.html
    ========

    <html>
    <head>
    <title>GuitarMidi</title>
    <link href="mystyle.css" rel="stylesheet" type="text/css">
    </head>
    <body>

    <table class="one">
    <tr>
    <td>
    <p class = "one">search for artist or song</p>
    <form method="post" action="search.asp">
    <table class="two">
    <tr>
    <td><input type="text" name="textQuery" size="50"></td>
    </tr>
    </table>
    <p><input type="submit" value="Search"/></p>
    </form>

    <p><a href="view.asp">view all</a></p>

    </td>
    </tr>
    </table>

    <p><a
    href="javascript:window.external.AddFavorite('http://www.guitarmidi.co.uk','GuitarMidi')">Add
    to favourites</a>
    | <a href="http://www.vanbasco.com/karaokeplayer/"
    target="_blank">vanBasco's Karaoke Player</a></p>

    <p>
    <a href="http://validator.w3.org/check/referer" target="_blank">
    <img src="images/valid_xhtml.png"
    alt="Valid XHTML 1.0!" width="80" height="15"/></a>

    <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank">
    <img src="images/valid_css.png"
    alt="Valid CSS!" width="80" height="15"/></a>
    </p>

    </body>

    </html>


    ***************************************************************
    search.asp
    ========

    <%@ Language="VBScript" %>

    <%

    dim objDom, fileExists, objFieldValue, objPI

    st1 = Request.Form("textQuery")
    st2 = Request.QueryString("startPos")

    a=Split(lcase(st1))

    set xmlDocument = CreateObject("MSXML2.FreeThreadedDOMDocument")
    xmlDocument.async="false"
    xmlDocument.load(Server.MapPath("db/data.xml"))

    set xslDocument = CreateObject("MSXML2.FreeThreadedDOMDocument")
    xslDocument.async="false"
    xslDocument.load(Server.MapPath("search.xsl"))

    Set XSLTemplate = Server.CreateObject("MSXML2.XSLTemplate")
    Set XSLTemplate.stylesheet = xslDocument
    Set proc = XSLTemplate.createProcessor()

    proc.input = xmlDocument

    for n = 0 to ubound(a)
    proc.addParameter "text" & n, a(n)
    next

    proc.addParameter "full", st1

    proc.Transform
    Response.Write proc.output

    %>

    *************************************************************************
    search.xsl
    =======

    <?xml version="1.0"?>

    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:eek:utput method="html"/>

    <xsl:param name="text0" />
    <xsl:param name="text1" />
    <xsl:param name="text2" />
    <xsl:param name="text3" />
    <xsl:param name="text4" />

    <xsl:template match="/">

    <html>

    <head>
    <link rel="stylesheet" type="text/css" href="mystyle.css" />
    <title>Results</title>
    </head>

    <body>

    <table class="three" align="center">

    <col width="40%"/>
    <col width="40%"/>
    <col width="10%"/>
    <col width="10%"/>

    <tr>
    <th class="head1">Artist</th>
    <th class="head1">Song</th>
    <th class="head">Chord</th>
    <th class="head">Midi</th>
    </tr>

    <xsl:for-each select="(cat/links[(contains(artist, $text0) or contains(song,
    $text0)) and
    (contains(artist, $text1) or contains(song, $text1)) and
    (contains(artist, $text2) or contains(song, $text2)) and
    (contains(artist, $text3) or contains(song, $text3)) and
    (contains(artist, $text4) or contains(song, $text4))])[position() &lt;=
    20]">

    <xsl:sort select="artist"/>
    <xsl:sort select="song"/>

    <tr>
    <td class="one"><xsl:apply-templates select="./artist"/></td>
    <td class="one"><xsl:apply-templates select="./song"/></td>
    <xsl:variable name="path1"><xsl:apply-templates
    select="./path"/></xsl:variable>
    <td><a href="media/{$path1}.txt" target="_blank">view</a></td>
    <td><a href="media/{$path1}.mid">play</a></td>
    </tr>

    </xsl:for-each>

    </table>

    <a href="index.html">Click here to return to search page</a>

    </body>

    </html>

    </xsl:template>

    </xsl:stylesheet>


    "Richard Tobin" <> wrote in message
    news:djuk13$ema$...
    > In article <MfA8f.36219$>,
    > thomas <> wrote:
    >
    >><td>£<xsl:apply-templates select="./price" /></td>
    >><td>£<xsl:apply-templates select="./price" /></td>

    >
    > Both of these are correct.
    >
    >>both of these give a ? sign instead of a £ sign

    >
    > That sentence appears on my screen with two question marks in it,
    > which is a clue to the cause of your problem.
    >
    > Most likely, your XSLT processor is outputting the document in one
    > encoding, but your HTML viewer is interpreting it in some other
    > encoding. If you're looking at it in a browser, try telling it to
    > assume a different encoding (UTF-8 for example). Or try telling XSLT
    > to output it in Latin-1 by using <xsl:eek:utput encoding="iso-8859-1"/>.
    >
    > -- Richard
    >
     
    thomas, Oct 29, 2005
    #3
  4. thomas

    Peter Flynn Guest

    Re: ?? sign with xsl

    Richard Tobin wrote:

    > In article <MfA8f.36219$>,
    > thomas <> wrote:
    >
    >><td>£<xsl:apply-templates select="./price" /></td>
    >><td>£<xsl:apply-templates select="./price" /></td>

    >
    > Both of these are correct.
    >
    >>both of these give a ? sign instead of a ?? sign

    >
    > That sentence appears on my screen with two question marks in it,
    > which is a clue to the cause of your problem.


    And it appears on my screen as two spaces, which should be more of
    a clue.

    ///Peter
    --
    XML FAQ: http://xml.silmaril.ie/
     
    Peter Flynn, Oct 29, 2005
    #4
  5. thomas

    Peter Flynn Guest

    Re: ?? sign with xsl

    thomas wrote:

    > If you go to http://www.guitarmidi.co.uk/gui/browse.asp?id=h and view
    > source, the following line is in the <head> <META
    > http-equiv="Content-Type" content="text/html; charset=UTF-16">. Is
    > this why i'm having problems?


    Yes. If your work is all in English, why use twice as many bytes
    as you need to?

    ///Peter
    --
    XML FAQ: http://xml.silmaril.ie/
     
    Peter Flynn, Oct 29, 2005
    #5
    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. Kevin Flood
    Replies:
    0
    Views:
    1,040
    Kevin Flood
    Sep 8, 2004
  2. Kevin Flood
    Replies:
    1
    Views:
    2,792
    Kevin Flood
    Sep 13, 2004
  3. Replies:
    1
    Views:
    3,651
    A. Bolmarcich
    May 27, 2005
  4. Jimmy
    Replies:
    1
    Views:
    974
    Cowboy \(Gregory A. Beamer\)
    Nov 21, 2006
  5. Jimmy
    Replies:
    3
    Views:
    2,439
    shimmyshack
    Nov 20, 2006
Loading...

Share This Page