[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Context Assignment Question and New to list.


Subject: Re: [xsl] Context Assignment Question and New to list.
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 15 Apr 2004 15:12:21 -0400

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@xxxxxxxxxxxxxxxx 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 ======================================================================


Current Thread
Keywords
xml