Subject: [xsl] ancestor/subsequent descendant test From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx> Date: Sat, 28 Mar 2009 04:51:59 +1300 |
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[@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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Putting apostrophes aroun, Michael Kay | Thread | Re: [xsl] ancestor/subsequent desce, G. Ken Holman |
Re: [xsl] Need help combing two ele, Fatbob | Date | Re: [xsl] ancestor/subsequent desce, G. Ken Holman |
Month |