Re: [xsl] xsl:key, multiple conditions on sub elements

Subject: Re: [xsl] xsl:key, multiple conditions on sub elements
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 28 Oct 2005 22:37:41 +0100
> Is there a way to make the key select only "Associations" that have 
> aggregation="shared" and type="xxx" in the _same_ child element of the
> "Association"?


You have 

<xsl:key name="childassociations"
match="//UML:Association[UML:Association.connection/UML:AssociationEnd/@aggregation='shared']"
use="UML:Association.connection/UML:AssociationEnd/@type"/>

(by  the way you never need to start a match pattern with // :it doesn't
do much in a match template and doesn't do anything at all in a key.)

That says match on Association that have a grandchild with the shared
attribute, and index them by the type attribute of (any) AssociationEnd
grandchild.

If I understand you correctly, you just want 

<xsl:key name="childassociations"
match="UML:Association"
use="UML:Association.connection/UML:AssociationEnd[@aggregation='shared']/@type"/>

as that indexes the ones you want with the type attriibute (and
everything else with "", you could add the filter back to the match
pattern so you only index the ones that you actually need but..)

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread