Hi John. Taking a quick look, I don't see how you expect the
apply-templates' cfg param to be passed to <xsl:template match="col"
mode="foo">, since it selects select="$cfg/config/columns" (notice columns
vs. col). So it would first go through the default template and then
ripple down to your "col" template. The default template would swallow and
not pass on the param. If you change the select statement to
"$cfg/config/columns/col" it seems to work fine.
The XSL WG has considered some sort of feature to auto-pass params. I am a
big advocate of this (in some form), but I think we decided such a feature
would be too much at the moment.
-scott
John Gentilin
<gentijo@eyecatch To: xalan
<[EMAIL PROTECTED]>
ing.com> cc: (bcc: Scott
Boag/Cambridge/IBM)
Subject: apply-templates with-param
bug ??
09/10/2002 02:58
PM
Please respond to
xalan-dev
I am using a variable that holds complex data in my stylesheet.
To reduce the number of times I call xalan:nodeset() on the variable,
I pass the resultant variable as a parameter from template to template.
This works fine in a call-template but when used in a apply-templates,
the variable looks like it is converted into a value instead of a
nodeset.
Is this a bug ??
Regards
John G
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
extension-element-prefixes="xalan"
exclude-result-prefixes="xalan">
<xsl:variable name="CategoryConfig">
<config>
<columns inDBOrder="true">
<col name="FundName" width="79mm" colMap="DisplayName"
mode="def"/>
</columns>
</config>
</xsl:variable>
<xsl:template match="/">
<xsl:variable name="cfg" select="xalan:nodeset($CategoryConfig)" />
<output>
<xsl:copy-of select="$cfg" />
<!-- Declare the Column Widths -->
<xsl:for-each select="$cfg/config/columns/col">
<table-column column-width="{@width}"/>
</xsl:for-each>
<xsl:call-template name="dup">
<xsl:with-param name="cfg" select="$cfg"/>
</xsl:call-template>
<xsl:apply-templates select="$cfg/config/columns" mode="foo">
<xsl:with-param name="cfg" select="$cfg"/>
</xsl:apply-templates>
</output>
</xsl:template>
<xsl:template name="dup">
<xsl:param name="cfg"/>
<xsl:for-each select="$cfg/config/columns/col">
<table-column column-width="{@width}"/>
</xsl:for-each>
</xsl:template>
<xsl:template match="col" mode="foo">
<xsl:param name="cfg"/>
<xsl:for-each select="$cfg/config/columns/col">
<table-column column-width="{@width}"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
--
--------------------------------------
John Gentilin
Eye Catching Solutions Inc.
18314 Carlwyn Drive
Castro Valley CA 94546
Contact Info
[EMAIL PROTECTED]
Ca Office 1-510-881-4821
NJ Office 1-732-422-4917