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

Re: [xsl] dynamically applying templates


Subject: Re: [xsl] dynamically applying templates
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 14 Sep 2004 16:27:37 -0400

Hi again Bruce,

At 02:45 PM 9/14/2004, you wrote:
On Sep 14, 2004, at 2:13 PM, Wendell Piez wrote:

<xsl:template match="cs:reftype">
  <xsl:param name="source"/>
  <xsl:apply-templates>
    <xsl:with-param name="source" select="."/>

In this case, what exactly is the parameter doing? Are you using this precisely to do the, as you later say, "jumping back and forth between the trees"? So here you're apply-templates to the cs:* elements, and elsewhere to mods:*?

Yes. I'm matching a node in your configuration (the reftype), since its organization and content will drive processing.

OK, am with you.


But I'm passing a reference back to the mods source so that it can be
"jumped back to" anytime I need its data.

This is where I'm getting lost. How is this working? I see a param with a cs:reftype template, and then a select of that same element. Where is mods coming in here?

Oops! I meant:


 <xsl:apply-templates>
    <xsl:with-param name="source" select="$source"/>
 </xsl:apply-template>

...which is where the tunneling could help you. (Remember the $source parameter is bound to the "original" context node, where your source data is, while you traverse this other tree.)

I confess even I find all this rather bewildering, however (hence easy typo/glitches like the above), so I can only imagine how you're feeling.

This way, not only the content, but also the structure of your
cs:reftype can drive processing, without fancy tests.

And this is exactly what I need.

Good: so I'm not *completely* off base.


I think I find it hard to wrap my head around the context stuff; it's
where I consistently get confused.

Program your brain to recognize that in a template (which could be inside a for-each iteration), the context node is always the node that was matched (or in a for-each, selected), i.e. the "current node". (Within a predicate in an XPath expression the context node has changed: that's why we distinguish between context node and current node.)


I'm going to leave the deeper look-see for later (being rather snowed myself), if you don't mind, and hope that the correction above will confirm that you're on the right track....

Cheers,
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 ======================================================================


--+------------------------------------------------------------------ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/ or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx> --+--


Current Thread
Keywords