|
Subject: Re: Re: RE: [xsl] Best Practice - collection() function From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Mon, 7 Jul 2008 14:44:01 +0100 |
> 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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: Re: RE: [xsl] Best Practice - c, philip.vallone | Thread | Re: Re: RE: [xsl] Best Practice - c, philip.vallone |
| Re: Re: RE: [xsl] Best Practice - c, vladimir@xxxxxxxxxxx | Date | Re: Re: Re: RE: [xsl] Best Practice, philip.vallone |
| Month |