[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] find unique codes


Subject: Re: [xsl] find unique codes
From: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Wed, 22 Aug 2001 12:32:54 +0200

Xiaocun Xu <xiaocunxu@xxxxxxxxx> 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



Current Thread