Problem switching to my homepage

Discussion in 'XML' started by Mark Constant, Nov 24, 2003.

  1. I was doing a test website where on one page somebody could select a
    Genre from a drop-down list and it would display every sub-listing
    under that specific Genre. If the user selected All it would display
    everything. Now I have tried to implement it into my real homepage and
    I am having a little problem. Now not only do I pass the Genre to my
    XSLT but I pass the Hardware selection to the XSLT file. I get this
    error.

    "Expected token 'EOF' found ':'.
    lc:Entertainment/lc-->:<--$Hardware

    Here is my drop-down list
    <select name="select1" onchange='CallXML(this.form.select1, "PS2");'>
    <option selected>Please Select a Genre</option>
    <option value="All">All</option>
    <option value="Fighting">Fighting</option>
    <option value="FPS">First Person Shooter</option>
    <option value="Platformer">Platformer</option>
    <option value="Sports">Sports</option>
    <option value="TPA">Third Person Action</option>
    </select>

    Here is my Javascript file.
    function CallXML(dropdown, hardware)
    {
    var myIndex = dropdown.selectedIndex;
    var SelValue = dropdown.options[myIndex].value;
    var xsltTree = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
    xsltTree.async = false;
    xsltTree.load("Entertainment.xslt")

    var srcTree = new ActiveXObject("Msxml2.DOMDocument.4.0");
    srcTree.async = false;
    srcTree.load("Entertainment.xml");

    var xsltThread = new ActiveXObject("Msxml2.XSLTemplate.4.0");
    xsltThread.stylesheet = xsltTree;
    var xsltProc = xsltThread.createProcessor();
    xsltProc.input = srcTree;
    xsltProc.addParameter("Hardware", hardware);
    xsltProc.addParameter("Genre", SelValue);


    xsltProc.transform();
    GameTable.innerHTML = xsltProc.output;
    }

    Here is my XSLT file
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:lc="http://mark/Homepage">
    <xsl:eek:utput method="html"/>
    <xsl:param name="Hardware"/>
    <xsl:param name="Genre"/>

    <xsl:template match="/">
    <xsl:choose>
    <xsl:when test="$Genre = 'All'">
    <xsl:call-template name="All" />
    </xsl:when>
    <xsl:eek:therwise>
    <xsl:call-template name="NotAll" />
    </xsl:eek:therwise>
    </xsl:choose>
    </xsl:template>

    <xsl:template name="All">
    <table border="0">
    <xsl:for-each select="lc:Entertainment/lc:$Hardware">
    <tr>
    <th colspan="2" bgcolor="Green"><xsl:value-of
    select="lc:Title"/></th>
    </tr>
    <tr>
    <td>
    <xsl:element name="IMG">
    <xsl:attribute name="SRC">
    <xsl:value-of select="lc:picture"/>
    </xsl:attribute>
    </xsl:element>
    </td>
    <td>
    <xsl:value-of select="lc:Description"/>
    </td>
    </tr>
    </xsl:for-each>
    </table>
    </xsl:template>

    <xsl:template name="NotAll">
    <table border="0">
    <xsl:for-each select="lc:Entertainment/lc:$Hardware[lc:Genre =
    $Genre]">
    <tr>
    <th colspan="2" bgcolor="Green"><xsl:value-of
    select="lc:Title"/></th>
    </tr>
    <tr>
    <td>
    <xsl:element name="IMG">
    <xsl:attribute name="SRC">
    <xsl:value-of select="lc:picture"/>
    </xsl:attribute>
    </xsl:element>
    </td>
    <td>
    <xsl:value-of select="lc:Description"/>
    </td>
    </tr>
    </xsl:for-each>
    </table>
    </xsl:template>

    </xsl:stylesheet>

    Here is a portion of my XML file
    <Entertainment xmlns="http://mark/Homepage/">
    <PS2>
    <Genre>Fighting</Genre>
    <Picture>images\ps2\MortalKombat.gif</Picture>
    <Rating>5</Rating>
    <Title>Mortal Kombat Deadly Alliance</Title>
    <userCount>0</userCount>
    <userRating>0</userRating>
    </PS2>
    <PS2>
    <Genre>Fighting</Genre>
    <Picture>images\ps2\NoGif.gif</Picture>
    <Rating>4</Rating>
    <Title>Virtua Fighter 4: Evolution</Title>
    <userCount>0</userCount>
    <userRating>0</userRating>
    </PS2>
    Mark Constant, Nov 24, 2003
    #1
    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. Hans Kesting

    Re: Back to homepage on session timeout

    Hans Kesting, Aug 13, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    361
    Hans Kesting
    Aug 13, 2003
  2. =?Utf-8?B?TXJNaWtl?=

    Enter Button Takes You to HomePage

    =?Utf-8?B?TXJNaWtl?=, Jan 7, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    309
    Curt_C [MVP]
    Jan 7, 2005
  3. ALI-R

    can homepage be index.aspx?

    ALI-R, Feb 20, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    696
    Ali-R
    Feb 23, 2005
  4. Henry Lee
    Replies:
    1
    Views:
    432
    =?Utf-8?B?RFdT?=
    Apr 6, 2006
  5. Bruno Moura

    Problem for load github homepage

    Bruno Moura, Jun 21, 2009, in forum: Ruby
    Replies:
    2
    Views:
    102
    Robert Klemme
    Jun 22, 2009
Loading...

Share This Page