RE: [xsl] FW: Two-Column XSL question

Subject: RE: [xsl] FW: Two-Column XSL question
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 31 Jan 2008 15:24:41 -0000
> 1-    <xsl:variable name="others"
select="following-sibling::option[position() &lt; 2]" />

selects the immediately following sibling. Same as
following-sibling::option[1], but the code was presumably written this way
so that 2 could be replaced by any number as the number of columns; if it
was 5 then the meaning would be "the first 4 following siblings".

> 2-       <xsl:for-each select=".|$others">

"|" forms the union of two node sets: in this case, the union of "." (the
context node) and $others. So if you want four columns,
.|following-sibling::*[position() &lt; 4] selects this node and the next
three.

> 3-  <xsl:if test="not($others)">

not() takes the effective boolean value of its operand; the EBV of a
node-set is true except when the node-set is empty. So this (common)
construct tests true if $others is an empty node-set.

Michael Kay
http://www.saxonica.com/

Current Thread