[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: using xsl:with-param in apply-templates problem

Subject: Re: using xsl:with-param in apply-templates problem
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 27 Aug 2002 11:33:02 +0100
dinsey pattern
    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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.