Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Problem switching to my homepage

Reply
Thread Tools

Problem switching to my homepage

 
 
Mark Constant
Guest
Posts: n/a
 
      11-24-2003
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"
xmlnssl="http://www.w3.org/1999/XSL/Transform"
xmlns:lc="http://mark/Homepage">
<xslutput method="html"/>
<xslaram name="Hardware"/>
<xslaram name="Genre"/>

<xsl:template match="/">
<xsl:choose>
<xsl:when test="$Genre = 'All'">
<xsl:call-template name="All" />
</xsl:when>
<xsltherwise>
<xsl:call-template name="NotAll" />
</xsltherwise>
</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="lcicture"/>
</xsl:attribute>
</xsl:element>
</td>
<td>
<xsl:value-of select="lcescription"/>
</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="lcicture"/>
</xsl:attribute>
</xsl:element>
</td>
<td>
<xsl:value-of select="lcescription"/>
</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>
 
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
Problem for load github homepage Bruno Moura Ruby 2 06-22-2009 06:34 AM
Process Switching vs. Fast/CEF Switching? asdf Cisco 7 05-29-2007 05:26 PM
Resetting homepage problem Paul Computer Information 5 07-20-2004 02:44 PM
Spyware problem/homepage Albert Alverez Computer Support 1 06-19-2004 01:25 AM
Homepage Keeps problem Raymond A+ Certification 2 03-07-2004 05:08 AM



Advertisments