xsl-list
[Top] [All Lists]

RE: Generate implicit wrapper element -- details

2005-08-31 05:33:47

I worked through this example and it worked as desired. 
However, I am having
trouble understanding what is happening in these matches:

<xsl:template match="li[not(preceding-sibling::*[1][self::li])]"/>

Matches an li element whose first preceding sibling is not an li element.

Start from the end: self::li selects the context node if it is an li
element, or nothing if it is not.

Within [] this node-set is converted to a boolean, so the predicate
[self::li] is true if the context node is an li element.

preceding-sibling::*[1] selects the first preceding element if there is one.

So preceding-sibling::*[1][self::li] selects the first preceding element if
there is one and it is an li element.

So not(preceding-sibling::*[1][self::li]) returns true if (a) the context
item has no preceding element, or (b) the first preceding sibling element is
not an li element.

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



<xsl:apply-templates select="following-sibling::*[1][self::li]"
                       mode="in-list"/>

Thanks for any explanation that you can give.

Rick Quatro
Carmen Publishing
585 659-8267
www.frameexpert.com


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





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