Mark Constant
Usenet Archive
- Joined
- Apr 9, 2003
- Messages
- 38
- Reaction score
- 0
I have a xslt file and it keeps giving me an EOF error when it reaches the point <xsl:for-each select="lc:Entertainment/lc:$Hardware[lc:Genre = $Genre]"> and <xsl:for-each select="lc:Entertainment/lc:$Hardware">
My xslt file looks like this
<?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
utput method="html"/> <xsl
aram name="Hardware"/> <xsl
aram name="Genre"/>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$Genre = 'All'">
<xsl:call-template name="All" />
</xsl:when>
<xsl
therwise>
<xsl:call-template name="NotAll" />
</xsl
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
icture"/>
</xsl:attribute>
</xsl:element>
</td>
<td>
<xsl:value-of select="lc
escription"/>
</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
icture"/> </xsl:attribute> </xsl:element> </td> <td> <xsl:value-of select="lc
escription"/> </td> </tr> </xsl:for-each> </table> </xsl:template>
</xsl:stylesheet>
My xml file looks like this
<Entertainment xmlns="http://mark/Homepage/"> <Movie> <Title>Terminator 1</Title> <Description>A T100 machine comes back from the future to destroy Sarah Connor who will give birth to a kid who will go on to save the world.</Description> <Genre>Action</Genre> <Picture>images\movies\Terminator1.jpg</Picture> <Rating>5</Rating> </Movie> <Movie> <Title>Terminator 2</Title> <Description>The T100 is back again only this time he is back to save John Connor from a T1000</Description> <Genre>Action</Genre> <Picture>images\movies\Terminator2.jpg</Picture> <Rating>5</Rating> </Movie> <PS2> <Title>Mortal Kombat Deadly Alliance</Title> <Description>Quan Chi and Shang Tsung join forces to destroy Lui Kang and take over the wrold</Description> <Genre>Fighting</Genre> <Picture>images\ps2\MortalKombat.jpg</Picture> <Rating>5</Rating> </PS2> <PS2> <Title>Sly Cooper</Title> <Description>A racoon must travel around the world to get back pieces of a book that has been in his family for generations</Description> <Genre>Platformer</Genre> <Picture>images\ps2\SlyCooper</Picture> <Rating>5</Rating> </PS2> </Entertainment>
I am passing my variable through a piece of Javascript code that looks like this xsltProc.addParameter("Hardware", Hardware); xsltProc.addParameter("Genre", SelValue);
My xslt file looks like this
<?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
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$Genre = 'All'">
<xsl:call-template name="All" />
</xsl:when>
<xsl
<xsl:call-template name="NotAll" />
</xsl
</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
</xsl:attribute>
</xsl:element>
</td>
<td>
<xsl:value-of select="lc
</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
</xsl:stylesheet>
My xml file looks like this
<Entertainment xmlns="http://mark/Homepage/"> <Movie> <Title>Terminator 1</Title> <Description>A T100 machine comes back from the future to destroy Sarah Connor who will give birth to a kid who will go on to save the world.</Description> <Genre>Action</Genre> <Picture>images\movies\Terminator1.jpg</Picture> <Rating>5</Rating> </Movie> <Movie> <Title>Terminator 2</Title> <Description>The T100 is back again only this time he is back to save John Connor from a T1000</Description> <Genre>Action</Genre> <Picture>images\movies\Terminator2.jpg</Picture> <Rating>5</Rating> </Movie> <PS2> <Title>Mortal Kombat Deadly Alliance</Title> <Description>Quan Chi and Shang Tsung join forces to destroy Lui Kang and take over the wrold</Description> <Genre>Fighting</Genre> <Picture>images\ps2\MortalKombat.jpg</Picture> <Rating>5</Rating> </PS2> <PS2> <Title>Sly Cooper</Title> <Description>A racoon must travel around the world to get back pieces of a book that has been in his family for generations</Description> <Genre>Platformer</Genre> <Picture>images\ps2\SlyCooper</Picture> <Rating>5</Rating> </PS2> </Entertainment>
I am passing my variable through a piece of Javascript code that looks like this xsltProc.addParameter("Hardware", Hardware); xsltProc.addParameter("Genre", SelValue);