[xsl] Re: Re: distinct moves problem

Subject: [xsl] Re: Re: distinct moves problem
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 10 Jan 2002 05:25:03 -0800 (PST)
> Hi Dimitre,
> 
> Many thanks for that, indeed it does give the accurate
> number of moves of each character. The only slight difficulty
> is that it also produces duplicates, e.g.
> 
> Character_ID:  18815 :
>      48984 
>      5050 
>      293 
>      293 
>      293 
>      23359 
>      23359 
>      23359 
>      23359 
>      23359 
>      23359 
>      23359 
>      293 
>      293 

Producing duplicates should not be possible with the latest solution presented.

Using the key:

>   <xsl:key name="kLocByCharacter" 
>            match="LOCATION_ID[not(. 
>                                   = 
>                                   ../preceding-sibling::DIRECT[1] 
>                                                 /LOCATION_ID) 
>                               ]" 
>            use="../CHARACTER_ID"/> 

excludes this possibility.

And the example, with which this was tested clearly showed that duplicates were
discarded.

Therefore, either:

        you didn't copy correctly the stylesheet.
or
        you're using a source xml with significantly different structure (e.g. some
DIRECT elements are not siblings.

or
        some values of LOCATION_ID contain whitespace.

In the last case the above key definition can be modified to ignore the whitespace
by using the normalize-space() function:

   <xsl:key name="kLocByCharacter" 
            match="LOCATION_ID[not(normalize-space() 
                                   = 
                                   normalize-space(../preceding-sibling::DIRECT[1]) 
                               ]" 
            use="../CHARACTER_ID"/> 



In case you send an example (the smallest and simplest possible) that reproduces the
problem) to my email address, I would be better able to determine the exact problem.

Cheers,
Dimitre Novatchev.


__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread