This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Fwd: document() doesn't pick up a param
- To: Michael Labhard <mlabhard at viatraining dot com>
- Subject: Re: Fwd: document() doesn't pick up a param
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Thu, 07 Sep 2000 21:53:31 +0100
- Cc: xsl-list at mulberrytech dot com
- Reply-To: xsl-list at mulberrytech dot com
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