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

finding closest node with certain characteristics

Subject: finding closest node with certain characteristics
From: "Steve Ylvisaker ylvisaker.steve@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 6 May 2014 14:23:35 -0000
 finding closest node with certain characteristics

I am implementing a variation on Ken's PSMI process to accommodate some
special needs for tax tables in our composition to PDF process. So, my input
is a namespace fo file that contains a special wrapper:
<psmi:inserted-page-geometry/>. This wrapper may occur multiple times within
the XML instance.

All is well with my psmi process, however, I can run into situations where
an element following the psmi wrapper has the break-after="page" or
break-before="page" attribute associated with it and is now redundant
resulting in a blank page.

So I need to find the first occurrence of any element with attribute
break-after (or break-before) following a psmi wrapper and determine if
there is any content between that element and the psmi wrapper. If there is
no content then the page break request is likely redundant and needs to be

Example data:

   ~large table markup ~
<fo:block margin-top="8pt">
  <fo:marker marker-class-name="runningFoot"/>
  <fo:block span="all" break-after="page"/>
  <fo:block>Composition text here</fo:block>

My problem is that the psmi wrapper may occur multiple times in the xml
instance so I need to determine if my break-after element is the first one
following the closest psmi wrapper. I know I have figured this out before
but have a block trying to figure it out now.

psudo code:
<xsl:template match="*[@break-after]">
<!-- this test is where I need help, the rest I am fine with -->
  <xsl:when test="(I am the first occurrence of an element with the
attribute break-after following the closest psmi wrapper element) and 
                  (there is no content in the elements that exist between me
and the closest psmi wrapper element)">copy the element without the
break-after attribute</xsl:when>
  <xsl:otherwise>copy the element as it occurred in the xml

Thanks for any clues.

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.