xsl-list
[Top] [All Lists]

Re: [xsl] duplicate elimination

2014-11-01 12:56:16
Ihe Onwuka ihe(_dot_)onwuka(_at_)gmail(_dot_)com wrote:


On Sat, Nov 1, 2014 at 5:26 PM, Martin Honnen 
martin(_dot_)honnen(_at_)gmx(_dot_)de
<mailto:martin(_dot_)honnen(_at_)gmx(_dot_)de> 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com
<mailto:xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com>> wrote:

    Use the "=" operator and all preceding sibling line elements:

       <xsl:template match="line[title[1] =
    preceding-sibling::line/title[__1]]"/>
       <xsl:template match="line">
         <xsl:apply-templates select="title[1]"/>
       </xsl:template>
    --~--


One of the variations I had tried before. It does not work.

When I use Saxon 6.5.5 against your posted input sample and the stylesheet

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  version="1.0">

  <xsl:template match="line[title[1] = preceding-sibling::line/title[1]]"/>

  <xsl:template match="line">
    <xsl:apply-templates select="title[1]"/>
  </xsl:template>

</xsl:stylesheet>

I get the output

<?xml version="1.0" encoding="utf-8"?>
      La foto
      La última parada (Lo peor de todo)
      Polvo Eres
      "7 días al desnudo"

      "7 vidas"


which looks fine to me as for eliminating the duplicates.
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>