|
Subject: Re: [xsl] using xsl:with-param in apply-templates problem From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 27 Aug 2002 11:33:02 +0100 |
Please see the code:
<xsl:template match="//file">
you never need to start a match pattern with //
match="file"
will do here (and is the same, apart from default priority)
<xsl:variable select="@name" name="filename"/>
This variable doesn't seem to be doing ,uch, you could
just use @name instead of $filename below.
<xsl:apply-templates select="document($filename)" mode="file">
This is OK but beware that it applies templates to the
root node (/) of the new document so you need a
template in the mode "file" that matches /
<xsl:with-param name="filename"><xsl:value-of
select="$filename"/></xsl:with-param>
Simpler and more efficient to make the parameter a
string (or actually in this case, attribute node)
rather than a result tree fragment:
<xsl:with-param name="filename" select="$filename"/>
</xsl:apply-templates>
</xsl:template>
For some reason the parameter is not being picked up, has anybody got
any ideas why?
almost certainly because you haven't a template for / in the mode file.
A simpler alternative is to apply templates to the top level element
rather than the document node, ie
<xsl:apply-templates select="document($filename)/*" mode="file">
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] using xsl:with-param in apply, Niki Dinsey | Thread | RE: [xsl] using xsl:with-param in a, Niki Dinsey |
| Re: [xsl] 8bit ascii encoding, David Carlisle | Date | [xsl] Constructing hierarchical XML, Lars Eskildsen |
| Month |