My input documents are allowed to contain nested sections. An optional
attribute marks out certain sections as significant. I want to detect a
situation in which a section which contains a descendant significant section
does not contain a subsequent INsignificant section (other than descendants
of any significant sections). It's complicated because the nested sections
are not (necessarily) immediate descendants of each other.
In the following short example:
<section>
<include>
<section>.A.</section>
<section sig="Y">
<section>.B.</section>
<include>
<section>.C.</section>
</include>
</section>
<!-- NB -->
<section sig="Y">
<section>.D.</section>
</section>
</include>
</section>
The section .A. is OK because there isn't a "significant" section before it.
The section .D. is OK because it is within a "significant section", but if
the section it is wrapped in did not have the significant attribute set then
I want to report it, because it is INsignificant and a descendant of a
section which contains a prior significant section.
I'm a bit stuck with this template, which identifies the correct ancestor,
but doesn't know how to detect a descendant non-significant section which is
outside and subsequent to the section which is originally matched by the
template. It surely isn't as complex as I'm finding it, can anybody help
please?
<xsl:template match="section[(_at_)sig="Y"]>
<xsl:for-each select="ancestor::*[self::section][1]">
<xsl:if test=" what goes here ???">
<xsl:message>error</xsl:message>
</xsl:for-each>
<xsl:template>
Thank you very much
Cheers
Trevor
--~------------------------------------------------------------------
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>
--~--