[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] How to properly use Key elements

Subject: Re: [xsl] How to properly use Key elements
From: "G. T. Stresen-Reuter" <tedmasterweb@xxxxxxxxx>
Date: Mon, 21 Oct 2013 23:47:09 +0100

On Oct 16, 2013, at 4:04 PM, Wendell Piez <wapiez@xxxxxxxxxxxxxxx> wrote:

> I am guessing you need something like
> <xsl:key name="ports-by-ship"
>       match="tr[count(td) = 4]/td[3]"
>       use="../td[1]"/>
> <xsl:key name="ports-by-ship"
>       match="tr[count(td) != 4]/td[1]"
>       use="../preceding-sibling::tr[count(td)=4][1]/td[1]"/>
> Note the use of two declarations for the same key. This is permitted,
> and very useful in cases like this. Here, the first declaration
> catches the ports from the rows with four cells, the second catches
> the ports from the others.
> Untested!

I just wanted to comment that this is really, really cool and that my final
solution is very similar to this one, if not exactly the same only using a
different syntax (joining matched sets via parentheses and a pipe character).

Thanks yet again for the help!


Current Thread