This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]