This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: <xsl:for-each select="$myvar">


> <xsl:param name="myvar"/>

That is special cased to set myvar to be an empty string.

the on the command line you probably go myvar=DEC and that (in most XSLT
systems) sets myvar to be the string 'DEC'

so going 

<xsl:for-each  select="$myvar"
is equivalent to going
<xsl:for-each select="'DEC'"

and gets the same error message as you can't for-each over a string.

Some XSLT systems let you pass in node sets as parameters, in which case
you'd want to set the default value to be
<xsl:param name="myvar" select="/.."/>
which is an empty node set, not an empty string
and do whatever sytem specific  calls you need to set the parameter to a
node set outside the stylesheet.

<xsl:for-each  select="$myvar"
would work.

If you want to pass in a string though, do something lik

<xsl:key name=manufacturer" match="item" use="manufacturer"/>

<xsl:for-each select="key('manufacturer',$myvar)">

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]