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

Re: Re: Re: RE: Best Practice - collection() function

Subject: Re: Re: Re: RE: Best Practice - collection() function
From: <philip.vallone@xxxxxxxxxxx>
Date: Mon, 07 Jul 2008 09:20:05 -0500 (CDT)
Re: Re: Re: RE:  Best Practice - collection() function
Hi Andrew,

Thank you for the help and guidance.

Regards,

Phil

From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: 2008/07/07 Mon AM 08:44:01 CDT
To: philip.vallone@xxxxxxxxxxx
Cc: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: Re: RE:  Best Practice - collection() function

>
> Thanks for the help. I think the question sounds odd because I may have not been clear. You say they [keys] are built once per input document; by input document, do you mean supplied input file or each document in the collection()? I ask so I get a better understanding of whats going on when I use the collection() function and Keys. Right now, it works great and all my documents (e.g. tables, xref) are indexed.
>


It depends... an input document can be the main input XML in
traditional transform, a variable holding a document node, a call to
doc() etc

Have a look at this transform:

<xsl:key name="elem-by-name" match="*" use="local-name(.)"/>

<xsl:variable name="foo1">
	<foo>foo 1</foo>	
</xsl:variable>

<xsl:variable name="foo2">
	<foo>foo 2</foo>	
</xsl:variable>

<xsl:variable name="combined">
	<xsl:sequence select="($foo1, $foo2)"/>
</xsl:variable>

<xsl:template name="main">
	<xsl:value-of select="key('elem-by-name', 'foo', $foo1)"/>	
	<xsl:value-of select="key('elem-by-name', 'foo', $foo2)"/>	
	<xsl:value-of select="key('elem-by-name', 'foo', $combined)"/>	
</xsl:template>

The same key, used on three different input documents, will cause
three indexes to be built (as is my understanding).  Notice how
$combined combines two other input documents so that the key operates
across both.

-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

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-2011 All Rights Reserved.