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

Re: combining multiple documents

Subject: Re: combining multiple documents
From: Steven Ericsson-Zenith <steven@xxxxxxxxxxxxx>
Date: Fri, 25 Jan 2008 10:25:26 -0800
Re:  combining multiple documents
Before I run off to test if parameter passing will meet my need let me ask an obvious question. By their nature keys can contain multiple elements. My example was meant to illustrate the passing of sets of such elements not individual elements.

Your proposed solution allows me only to pass one element of the key, when I want the entire contents of the key. Is there something I missed?

With respect,
Steven






On Jan 25, 2008, at 8:41 AM, David Carlisle wrote:





<!-- But actually we wanted to pass the extra for use here in the second instance of "document" -->

If you want to pass that. then pass it as a parameter.


<xsl:apply-templates select="doc(@file)"/>

don't do that, do this

     <xsl:apply-templates
                   select="doc(@file)/document">
		    <xsl:with-param name="extra"
                   select="key('extra','introduction')"/>
    </xsl:apply-templates>

aand declare this as a parameter to /document (rather than /, hence teh
change in the select above)




  <xsl:template
       match="/document">
  <xsl:param name="extra" select="()"/>


then you can use <xsl:apply-templates select"$extra"/>


wherever you need to use it.


couple of unrelated points


   <xsl:template
       match="/document">
       <xsl:choose>


It's usually simpler to rewrite a template that just consistes of an xsl:choose as separate templates.

  <xsl:for-each
                   select="key('extra','introduction')">
                   <xsl:apply-templates
                       select="child::node()"/>
   </xsl:for-each>

could more simply be written as

<xsl:apply-templates select="key('extra','introduction')/node()"/>

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________

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.