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]

Re: find unique codes


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


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