Re: [xsl] Distinct values with XPath query in stylesheet

Subject: Re: [xsl] Distinct values with XPath query in stylesheet
From: "Matthew Hailstone" <matthew.hailstone@xxxxxxxxx>
Date: Tue, 16 Sep 2008 12:32:15 -0600
Thanks for the tidbit. I will definitely remember that little handy function. :)

After creating my test.xml and looking at the XPath query with
different node names, I did some more testing and found a solution for
XPath 1.0.

The XPath in the fee-type-defs template is:
//RECORDABLE_DOCUMENT/FEES/FEE[@Description=$feeName and
not(@*[name()=$feeValueAttr]=parent::node()/parent::node()/preceding-sibling::node()/FEES/FEE[@Description=$feeName]/@*[name()=$feeValueAttr])]

I also modified the XPath query in the sort-Fees template:
FEES/FEE[not(@Description=parent::node()/parent::node()/preceding-sibling::node()/FEES/FEE/@Description)]

I wasn't taking into consideration the parent structure being so far back. :)

Thanks again!
Matthew

On Tue, Sep 16, 2008 at 11:58 AM, Ryan Graham <Ryan.Graham@xxxxxxxxxxx> wrote:
>
>
> Are you locked into using 1.0? In 2.0, you could use:
>
> distinct-values(//FEE[@Description = 'Fee Two']/@Amount)
>
> HTH,
> Ryan
>
> This message is private and confidential. If you have received it in error, please notify the sender and remove it from your system.

Current Thread