This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Using parameter in for-each select - newbie question
- To: <XSL-List at lists dot mulberrytech dot com>
- Subject: [xsl] Using parameter in for-each select - newbie question
- From: "Chris Theisen" <cjtheisen at yahoo dot com>
- Date: Thu, 22 Mar 2001 22:07:16 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
I'm trying to use a parameter in a for-each, but I get the error:
D:\TMP>xt vndtst.xml junk.xsl partst.csv table=vd_mstr
file:/D:/TMP/junk.xsl:13: expected node test
Here's the beginning:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xt="http://www.jclark.com/xt"
extension-element-prefixes="xt">
<xsl:output method="text"/>
<xsl:param name="table">default</xsl:param>
<xsl:template match="/">
<xsl:for-each select="//$table">
<xsl:call-template name="create-csv"/>
</xsl:for-each>
</xsl:template> <!--match="/"-->
I can change this to use choose, and hardcode all the table references:
.
.
.
<xsl:param name="table">default</xsl:param>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$table = 'vd_mstr'">
<xsl:for-each select="//vd_mstr">
<xsl:call-template name="create-csv"/>
</xsl:for-each>
</xsl:when>
<xsl:when test="$table = 'ad_mstr'">
<xsl:for-each select="//ad_mstr">
<xsl:call-template name="create-csv"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template> <!--match="/"-->
Any ideas why the first version won't work?
Thanks
Chris Theisen
cjtheisen@yahoo.com
1-313-277-2441 (Office)
1-734-502-8884 (Mobile)
1-978-428-6174 (eFax)
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list