Problem switching to my homepage

M

Mark Constant

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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top