xsl-list
[Top] [All Lists]

Re: Context Assignment Question and New to list.

2004-04-15 12:12:21
Hi Blaine,

At 02:21 PM 4/15/2004, you wrote:
I am adding features to some existing sets of template functions. One of these functions (funcA for example) assume a context node . My new template function (fucB) is fairly generic and takes in a node (say $cur_node), that it uses since I cannot depend on the context of the call to the template.

FuncB needs to make a call to FuncA.

Is there anyway to give $cur_node as the context for A?
Is there a function to "assign" context?

Sort of, though not a function, exactly. But if you can't rewrite FuncA to be context-neutral, you can work around it by switching context ad hoc, with a for-each (or even an apply-templates with a mode):

<xsl:template name="FuncB">
  <xsl:param name="cur-node" select="."/>
  ... whatever you do ...
  <xsl:for-each select="$cur_node">
    <xsl:call-template name="FuncA"/>
  </xsl:for-each>
  ... whatever else ...
</xsl:template>

I hope that helps,
Wendell


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================



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