xsl-list
[Top] [All Lists]

Re: [xsl] preceding-sibling:: oddity

2012-06-13 16:43:32


On 2012-06-13 23:26, Jeff Hooker wrote:
     <xsl:value-of select="preceding-sibling::ss:Cell[6]"/>

If all cells are present (they don’t have to – Excel may skip cells by using the @ss:Index attribute), your expression looks 6 cells behind, so you’ll get the value of the 5th (11 − 6) cell in the row. Just like preceding-sibling::*[1] doesn’t pick the first of all preceding siblings in document order, but it will pick the one that’s closest to your current item. You can pick ../ss:Cell[6] or (preceding-sibling::ss:Cell)[6] – they’ll be arranged in document order in the latter example.

But watch out for @ss:Index. It might be wise to fill the missing ss:Cells in a first pass, because in <ss:Row><ss:Cell/><ss:Cell ss:Index="6"/><ss:Cell ss:Index="11"/></ss:Row>, there’ll be no ss:Cell[6].

Gerrit

--~------------------------------------------------------------------
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>