[xsl] Help calling templates with parameters

Subject: [xsl] Help calling templates with parameters
From: Charlie Consumer <faceless1976@xxxxxxxxx>
Date: Tue, 21 Sep 2004 21:31:24 -0700 (PDT)
I'm trying to refactor my XSL so that I can make a
call to a template from several locations in my XSL. 
However, I need to parameterize this template with a
node set of where the data should come from.  I have
two documents that I'm merging together to result in
one document. I'm assigning parameter to a XPath to
the node set which is correct before I call the
template.  But, when I use it inside the template I
get "Cannot use result tree fragment.  Error in XPath
expression, Cannot use result tree fragment."  Here is
an example of what I'm doing:

<xsl:for-each
select="document($ruleFile)/rulelist/rule[@A='blah']">
   <xsl:call-template name="insertRule">
     <xsl:with-param name="currentRule"><xsl:value-of
select="current()"/></xsl:with-param>
   </xsl:call-template>
</xsl:for-each>

<xsl:template name="insertRule">
   <xsl:param name="currentRule"
   <xsl:element name="rule">
      <xsl:attribute name="id"><xsl:value-of
select="$currentRule/blah/@id"/></xsl:attribute>
   </xsl:element>
</xsl:template>

I'm using XMLSpy's debugger to step through the XSL,
and once I enter the template the parameter isn't a
node set like it was before I called the template, but
a node fragment.  I don't know what a node fragment
is.  Can anyone explain this?  And, what am I doing
wrong here?  Sorry I'm new to XSL.  I tried reading
the faq and archive, but I couldn't find anything
about this in either location.

Charlie


		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

Current Thread