xsl-list
[Top] [All Lists]

RE: [xsl] Testing implicit XHTML hierarchy

2007-07-05 02:57:50
The rules could be expressed like this:

1.    There can only be one h1, and it must be the first heading.
2.    The first heading after h1 must be h2.
3.    The first heading after h2 must be h2 or h3.
4.    The first heading after h3 must be h2 or h3 or h4.
5.    The first heading after h4 must be h2 or h3 or h4 or h5
6.    The first heading after h5 or h6 can be anything except h1.


Assuming the context node is one of these headings:

following-sibling::*[h:is-heading(.)][1][h:level(.) gt 1 and h:level(.) le
h:level(current())+1]

where

h:is-heading() is {matches(local-name(), 'h[1-6]')}

and

h:level() is {xs:integer(substring(local-name(), 2))

(And add a condition on the parent element that there is an h1)

Michael Kay
http://www.saxonica.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>
--~--