xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shane_curc...@us.ibm.com
Subject Fw: Problem Using an xsl:param in a Predicate
Date Mon, 12 May 2003 01:10:02 GMT
As usual, the best place to get Xalan questions answered is on the 
xalan-j-users@xml.apache.org list, as noted on our website.

You can read an archive at 

- Shane
----- Forwarded by Shane Curcuru on 05/11/2003 09:03 PM -----

I have a named template called 'find-persons-with-preference' which 
receives a single xsl:param with name = "preference", as shown below.
Note it contains several commented-out xsl:for-each statements which 
I have used during testing. 

<xsl:template name='find-persons-with-preference'>
                 <xsl:param name = "preference" />
                 <in-called-template pref='{$preference}' />
                 <xsl:for-each select = 
'/person:company/person:person[person:music-preference="$preference"]' >

                 <!--<xsl:for-each select = 
                 <!--<xsl:for-each select = 
'/person:company/person:person[person:music-preference="folk"]' >-->
                 <!--<xsl:for-each select = 
'/person:company/person:person' >-->
                                 <xsl:value-of select='@name' />

The predicate [person:music-preference="$preference"] returns no nodes. 
Nor does the version of the predicate with curly braces, 
[person:music-preference="{$preference}"].  However, the hard-coded 
version of the predicate, [person:music-preference="folk"], DOES return 
nodes.  Note this template begins by displaying the value of the 
parameter.  For example, when passed the parameter "folk", this template 
displays the line.

    <in-called-template pref="folk"></in-called-template>

When using the hard-coded version of the predicate, the following rows are 

    <in-called-template pref="folk"></in-called-template>

When using $preference in the predicate, either with or without the curly 
the following row is obtained instead:

    <in-called-template pref="folk"></in-called-template>

Is there something wrong with my non-hardcoded predicate?

Any help would be much appreciated.

Thank you.

View raw message