This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: find unique codes
- To: XSL List <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: [xsl] find unique codes
- From: Joerg Pietschmann <joerg dot pietschmann at zkb dot ch>
- Date: Wed, 22 Aug 2001 12:32:54 +0200
- Organization: ZKB
- Reply-To: xsl-list at lists dot mulberrytech dot com
Xiaocun Xu <xiaocunxu@yahoo.com> wrote:
> I am still struggling with this problem. I was
> thinking, is there a way to use declare one xsl:key
> across two different types of elements,
> ExtendedAttributeDefinition/@ExtendedAttributeDefinitionCode
> and ExtendedAttribute/@ExtendedAttributeCode?
Try something like (long names abbreviated...)
<xsl:for-each select="ExAtDe[not((preceding::ExAtDe/@ExAtDeCo
|preceding::ExAt/@ExAtCode)
=@ExAtDeCo)]
|ExAt[not((preceding::ExAtDe/@ExAtDeCo
|preceding::ExAt/@ExAtCo)
=@ExAtCo)]">
...
This may not be something you want because whether an eliminated
element is an ExAtDe or an ExAt is controlled by their position in
the document, if you want consistently weed out ExAt elements this
would be slightly more complex.
A key might improve performance, or it might degrade it (Muenchean
Grouping by the codes):
<xsl:key name="code" match="ExAt|ExAtDe" use="@ExAt|@ExAtDe"/>
<xsl:for-each select="ExAt[count(.|key('code',@ExAtCo))=1]
|ExAtDe[count(.|key('code',@ExAtDeCo))=1]">
...
Completely untestet. HTH anyway.
J.Pietschmann
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list