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(_at_)CraneSoftwrights(_dot_)com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--