[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

help on removing duplicates

Subject: help on removing duplicates
From: juan valentín-pastrana <jvalentin@xxxxxxxxxx>
Date: Thu, 20 Jan 2005 22:34:54 +0100
juan valentin pastrana
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


out of this xml:
<xml>
  <el>
    <node>A</node>
    <rel>
      <el>
        <node>X</node>
        <obj>myobject</obj>
      </el>
    </rel>
  </el>
  <el>
    <node>A</node>
    <rel>
      <el>
        <node>X</node>
        <obj>myobject</obj>
      </el>
    </rel>
  </el>
  <el>
    <node>A</node>
    <rel>
      <el>
        <node>Y</node>
        <obj>myobject</obj>
      </el>
    </rel>
  </el>
  ...
  <el>
    <node>B</node>
    <rel>
      <el>
        <node>X</node>
        <obj>myobject</obj>
      </el>
    </rel>
  </el>
  ...
</xml>

i want to get a list of the first level nodes (A, B, C..) with their related
nodes (X, Y, Z...) but removing duplicates, so i'd like to get:
        A-XY
        B-X
        ...

but using this -or simmilar principle- basic duplicate removing xsl script:
<!-- to avoid node group repetition -->
<xsl:template match = "/">
  <xsl:apply-templates
select="/xml/el[obj='myobject'][not(node=following::node)]">
    <xsl:sort select="node" />
  </xsl:apply-templates>
</xsl:template>

<xsl:template match="el">
  ...
  <xsl:value-of select="node">-
  <xsl:call-template name="XXX"><xsl:with-param name="node" ><xsl:value-of
select="node" /></xsl:with-param></xsl:call-template>
  ...
</xsl:template>

<xsl:template name="XXX">
  <xsl:for-each
select="/xml/el[node=$node]/rel/el[obj='myobject'][not(node=following-siblin
g::*)]">
    <xsl:value-of select="node">
  </xsl:for-each>
</xsl:template>

i wrongly get this:
        A-XXY
        B-X
        ...

as i don't have tight performance problems i don't need to resort to
muenchian methods, any idea on how to solve this ?

thanks

- - --
"Sobre lo que no se puede hablar hay que pasar de puntillas"
Ludwig Wittgenstein

Juan Valentmn-Pastrana
jvalentin@xxxxxxxxxx
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAkHwEvwACgkQWSh8rAinIHn1fgCdHlJ0GWlZihM8JGggL1IQQust
4dsAoIbGp317a1SHaTAS0vfKZlkH53g7
=T0VW
- -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAkHwI/4ACgkQWSh8rAinIHnuIACgkfKCplha6/Drzq8fNRfseptc
BxcAn1HcpJ7+HBhyUsACUnIj/XFeX5vp
=78++
-----END PGP SIGNATURE-----

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.