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

Re: duplicate elimination

Subject: Re: duplicate elimination
From: "Ihe Onwuka ihe.onwuka@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 1 Nov 2014 19:27:56 -0000
Re:  duplicate elimination
Oh thanks Martin for eliminating the blind alley I was wandering up.

On Sat, Nov 1, 2014 at 7:24 PM, Ihe Onwuka <ihe.onwuka@xxxxxxxxx> wrote:

> Solved. Templates were being applied to a single line element hence it had
> no siblings.
>
> Fix was to change the scope of the xsl:variable so that it entailed
> multiple line elements.
>
> On Sat, Nov 1, 2014 at 6:19 PM, Ihe Onwuka <ihe.onwuka@xxxxxxxxx> wrote:
>
>> Yes and it works when i use Saxon 9.5 whatever against the XML snippet
>> that I posted.
>>
>> Unfortunately for me that is not how the XML manifests, rather it is the
>> product of some intermediate step and pipelined through a variable.
>>
>> i.e the XML you saw is actually the content of a variable (call it $line)
>> which is the subject of an apply-templates as in <xsl:apply-templates
>> select="$line"/> where $line contains the posted XML.
>>
>> Now that shouldn't make a difference but duplicates aren't being
>> eliminated in this scenario.
>>
>> So the plot thickens.
>>
>> On Sat, Nov 1, 2014 at 5:56 PM, Martin Honnen martin.honnen@xxxxxx <
>> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>>
>>> Ihe Onwuka ihe.onwuka@xxxxxxxxx wrote:
>>>
>>>>
>>>>
>>>> On Sat, Nov 1, 2014 at 5:26 PM, Martin Honnen martin.honnen@xxxxxx
>>>> <mailto:martin.honnen@xxxxxx> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx
>>>> <mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>> 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 C:ltima parada (Lo peor de todo)
>>>       Polvo Eres
>>>       "7 dC-as al desnudo"
>>>
>>>       "7 vidas"
>>>
>>>
>>> which looks fine to me as for eliminating the duplicates.

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.