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

RE: ancestor/subsequent descendant test, problem resta

Subject: RE: ancestor/subsequent descendant test, problem restated
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 28 Mar 2009 07:34:38 +0100
RE:  ancestor/subsequent descendant test
At 2009-03-28 15:07 +1300, Trevor Nicholls wrote:
Anongst other stuff my input documents contain sections, and sections can
feature as descendants of other sections (either as children or as lower
order descendants). Certain sections are marked with a particular attribute
which I described as "significant".

I think the key that I missed out is how this significance affects later
processing of these documents: in one stylesheet which runs across these
documents any sections with the significant attribute invoke a new
result-document.

The condition which I am trying to detect is where there will be content
"left over". I suppose you could think of it as a place where the tree model
and the linear model are in conflict.
...
This case is not OK, the .D. section region is left hanging when the F2
result document is completed and thus it goes back into F1.

All the sections have ids (which I've left out of the example) which can be
used to report a problem.

Then all you need is to report those sections without the @sig that follow those sections with the @sig because they will then be "hanging" by your definition.


I hope this helps.

. . . . . . . . Ken

t:\ftemp>type trevor1.xml
  <!-- F1 -->
    <section>
      <include>
        <section>.A.</section>
  <!-- F2 -->
          <section sig="Y">
            <section>.B.</section>
            <include>
              <section>.C.</section>
            </include>
          </section>
  <!-- F3 -->
          <section sig="Y">
            <section>.D.</section>
          </section>
        </include>
      </section>

t:\ftemp>xslt trevor1.xml trevor.xsl

t:\ftemp>type trevor2.xml
  <!-- F1 -->
    <section>
      <include>
        <section>.A.</section>
  <!-- F2 -->
        <section sig="Y">
          <section>.B.</section>
          <include>
            <section>.C.</section>
          </include>
        </section>
  <!-- F1 -->
        <section>
          <section>.D.</section>
        </section>
      </include>
    </section>

t:\ftemp>xslt trevor2.xml trevor.xsl

Problem section:
t:\ftemp>type trevor.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

<xsl:output method="text"/>

<xsl:template match="/">
  <xsl:for-each select="//section[not(@sig='Y')]
                                 [preceding-sibling::section/@sig='Y']">
Problem section: <xsl:value-of select="@id"/>
  </xsl:for-each>
</xsl:template>

</xsl:stylesheet>

t:\ftemp>

--
XSLT/XSL-FO/XQuery training in Los Angeles (New dates!) 2009-06-08
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.