[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

ancestor/subsequent descendant test

Subject: ancestor/subsequent descendant test
From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
Date: Sat, 28 Mar 2009 04:51:59 +1300
 ancestor/subsequent descendant test
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 sig="Y">
   <!-- NB -->
     <section sig="Y">

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

 <xsl:template match="section[@sig="Y"]>
   <xsl:for-each select="ancestor::*[self::section][1]">
     <xsl:if test="   what goes here ???">

Thank you very much


Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.