This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: logical and in selection expression possible?


Templates are applied for every root element in the node set returned by the key(). If a key('key', 'rulekey1') returns more than one node, "the template is being activated twice". With the union operator | you merge two node sets, i.e. a node that is member of both node sets is only once contained in the unioned node set.

But this seems more or less uninteresting in your case. I assume you want to do something completely different. You only want to "collect" the nodes and operate with them in one template? Then <xsl:call-template> could be the choice while passing the keys to the template via a parameter:

<xsl:call-template name="foo">
<xsl:with-param name="bar" select="key('key', 'rulekey1') | key('key', rulekey2')"/>
</xsl:call-template>


<xsl:template name="foo">
<!-- default value: empty node set -->
<xsl:param name="bar" select="/.."/>
...
</xsl:template>

But a more concrete explanation of your problem can help.

Regards,

Joerg

Alex Reuter wrote:
Ok, I've run into a bit of a snag.
When I am passing the union of the nodesets to the applied template, it appears that the template is being activated twice. I was hoping to be able to access both nodesets at the same time.... unless they are the children of the same parent, is this impossible?
Thanks,
Alex


From: David Carlisle <davidc@nag.co.uk>
Reply-To: xsl-list@lists.mulberrytech.com
To: xsl-list@lists.mulberrytech.com
Subject: Re: [xsl] logical and in selection expression possible?
Date: Thu, 18 Jul 2002 17:17:29 +0100

<xsl:apply-templates select="key('key', rulekey1') and key('key',
'rulekey2') "/>

you want | there not and and is a boolean operator so this expression
will evaluate to true or false. but a select expression needs a node
set.


<xsl:template match="rule and rule2">

ditto.

David

XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]