xsl-list
[Top] [All Lists]

passing parameters between templates

2002-10-19 21:55:32
Hi everyone,

Can I send more than one parameter to a template like so:

    <xsl:template name="applications">
    <table border="1">
        <xsl:for-each select="$comp_ass/competancy/application">
            <xsl:variable name="app" select="."/>
            
            <tr><td><b><xsl:value-of select="$app" /></b></td>
            <td> <!--Param:<xsl:value-of select="$app"/> -->
            <xsl:call-template name="choicesGeneral">
                <xsl:with-param name="appIn" select="$app" />
                <xsl:with-param name="teach" select="yes" />
                <xsl:with-param name="type" select="general"/>
            </xsl:call-template>
            </td>
            </tr>
        </xsl:for-each>
        </table>
    </xsl:template>

    
    <xsl:template name="choicesGeneral">
        <!-- get the parameters passed in: -->
        <xsl:param name="appIn" />
        <xsl:param name="teach"/>
        <xsl:param name="type"/>
        
        <h2>Param: appIn</h2><xsl:value-of select="$appIn"/><br/>
        <h2>Param: teach</h2><xsl:value-of select="$teach"/><br/>
        <h2>Param: type</h2><xsl:value-of select="$type"/><br/>
        <table border="1">
        <!-- <xsl:variable name="app"
select="$comp_ass/competancy/application"/> -->
        <xsl:for-each select="$rating/rating[(_at_)type='general']">
            
            <xsl:variable name="value" select="@value" />
            <td>
            <input type="radio"
                        name="{$appIn}"
                       value="{$value}" />
                <xsl:value-of select="word"/>
            </td>
            
        </xsl:for-each>
        <xsl:if test="$teach = 'yes'">
            <td><input type="checkbox" name="{$appIn}-chk">Willing to
teach others</input></td>
        </xsl:if>
        </table>
    </xsl:template>

What I am trying to achieve is a constant table, but based on
variables create it in certain ways.

Thanks.


Pete.

-- 
                                Due to a lack of imagination, 
                                this signature will remain 
                                under construction indefinitely.

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



<Prev in Thread] Current Thread [Next in Thread>