Altova Mailing List Archives

RE: [xsl] passing parameter to template

From: "Michael Kay" <mhk@--------->
Date: 7/2/2003 12:51:00 PM
The apply-templates on document() is not going to invoke the template
with match="item", because document() is a document (root) node and
"item" matches an element. So if it's being called at all then the call
is indirect, via a built-in template; and built-in templates do not pass
their parameters on. 

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Fei Zheng
> Sent: 02 July 2003 18:21
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] passing parameter to template
> Hi all,
> I am having a problem with passing a paramter to template. It 
> works without using a second xml. Do you know how to code it 
> working with a second xml? 
> This is code which has no value pass into template. Anything 
> I am doing wrong?   Thanks!
> <xsl:for-each select="tech">
> 	<xsl:variable name="current-tech" select="@descr"/> 
> 	<xsl:apply-templates select="document('report.xml')" 
> mode="report">
> 		<xsl:with-param name="current" select="$current-tech"/>
> 	</xsl:apply-templates>
> </xsl:for-each>
> <xsl:template match="item" mode="report">
> <xsl:param name="current" />
> 	<xsl:if test="($current = metadata/technology)">
> 		<xsl:value-of select="content/company/." /><br/>
> 	</xsl:if>
> </xsl:template>
>  XSL-List info and archive:

 XSL-List info and archive:


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.