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

Re: "Tunneling" a parameter in document order

Subject: Re: "Tunneling" a parameter in document order
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 13 Apr 2012 13:01:53 -0400
Re:  "Tunneling" a parameter in document order
At 2012-04-13 10:31 +0200, Christian Roth wrote:
I'll try in a different way: Imagine someone has laid a rope along the path of a depth-first traversal of the document tree. The initial color of the rope is red. However, any node in the tree may decide to change its color (e.g. to green), which the rope then has from the start of that node on for all later (=following::) ones until we reach the document end, or up to the next node that chooses to change the rope's color again.

Isn't the length of rope with the new colour just the current length of the rope less the length of the rope at the last time the colour changed?


Which new color a node changes the rope's color to depends on its context and(!) the current color of the rope it has when it reaches it.

Fine, but if the boundaries are detectable then the distance between boundaries is the document-origin position of the "current" boundary less the document-origin position of the previous boundary.


Could you do something like:

  <xsl:variable name="this" select="count( preceding::whatever[] )"/>
  <xsl:variable name="previous"
    select="count( preceding::boundary[1]/preceding::whatever[] )"/>
  <xsl:value-of select="$this - $previous"/>

... or something I don't like doing but it may be necessary because of the nature of the counting:

  <xsl:variable name="this">
    <xsl:number level="any" count="...whatever..."/>
  </xsl:variable>
  <xsl:variable name="previous">
    <xsl:number select="...location of previous..."
                level="any" count="...whatever..."/>
  </xsl:variable>
  <xsl:value-of select="number($this) - number($previous)"/>

That way you are not trying to count *just* what is the current colour in the rope ... you know how to count to the beginning, so just count to the beginning of both the current location and the previous boundary to get the count of the current colour.

I think it is the column spanning attribute of DocBook that I implement in XSLT/XSL-FO using the number of columns from the start of the table for the current column subtract the number of columns from the start of the table for the start of the span in order to get the number of columns of the span itself. When you described your rope analogy I immediately thought of the named column spanning in DocBook.

I hope this helps.

. . . . . . . . . . . Ken

--
Public XSLT, XSL-FO, UBL and code list classes in Europe -- May 2012
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/
G. Ken Holman                   mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Google+ profile: https://plus.google.com/116832879756988317389/about
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.