xsl-list
[Top] [All Lists]

Re: [xsl] How to properly use Key elements

2013-10-21 17:47:22
On Oct 16, 2013, at 4:04 PM, Wendell Piez <wapiez(_at_)wendellpiez(_dot_)com> 
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!

Ted
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


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