Re: [xsl] logical and in selection expression possible?

Subject: Re: [xsl] logical and in selection expression possible?
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Sat, 20 Jul 2002 02:15:51 +0200
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@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
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


Current Thread