You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by John Gentilin <ge...@eyecatching.com> on 2002/09/10 20:58:00 UTC

apply-templates with-param bug ??

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
gentijo@eyecatching.com
Ca Office 1-510-881-4821
NJ Office 1-732-422-4917