Re: Fwd: document() doesn't pick up a param

Subject: Re: Fwd: document() doesn't pick up a param
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 07 Sep 2000 21:53:31 +0100
Michael,

>The XSL statement "with-param" doesn't seem to be carried over to
processing of
>nodesets from "document(...)" calls.

When you use document(), it gives you the *root node* of the document
that's named.  So when you do:

<xsl:apply-templates select="document('incoming.xml')">
  <xsl:with-param name="blah" select="555"/>
</xsl:apply-templates>

you're applying templates to the root node (/) of 'incoming.xml'.  In your
case, you have no template that explicitly matches the root node, so the
built-in template matches instead:

<xsl:template match="*|/">
  <xsl:apply-templates />
</xsl:template>

You'll notice that the built-in template doesn't declare any parameters nor
pass any on within the xsl:apply-templates.  Essentially this means that
any parameters you pass in are ignored and forgotten, and therefore appear
not to be being passed.

Rather than applying templates to the root node of the document, you want
to apply templates to the document element ('matchme'):

<xsl:apply-templates select="document('incoming.xml')/matchme">
  <xsl:with-param name="blah" select="555"/>
</xsl:apply-templates>

I hope that helps,

Jeni

Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread