At 2008-12-31 12:47 -0800, Kit Strong wrote:
I need a bit of help with count() as so far I've
been unable to construct a valid expression to obtain what I need
what I'm trying to do is generate Table numbers relative to Chapters but only
for tables that contain a title element. Here's an example
resolve to Table 1.1) ...<title>
<title class="table/title">(should resolve to
Table 1.2) ...<title>
<title class="table/title">Should resolve to Table 2.1
chapter number is easy enough 'count(preceding::chapter)+1' but what
problems with is the Table number in relation to the chapter
I can get the
Table position in relation to the document
')]/*[contains(@class,' topic/title ')])+1"
but I'm not quite sure how to
combine the 2 expressions to give me the proper count in relationship to the
Any help would be much appreciated.
I think you should just use what you need along the lines of the following:
<xsl:number count="*[contains(@class,' topic/table ')]
[*[contains(@class,' topic/title ')]]"
... instead of using count(). The from= limits the count to those
items below the closest matching ancestor.
Note also that I'm counting tables qualified by their title ... in
your code you were counting the table titles. Probably the same in
this case, but semantically I'm counting tables in case that helps
for maintenance and understanding.
I hope this helps.
. . . . . . . . . . . Ken
Upcoming XSLT/XSL-FO, UBL and code list hands-on training classes:
: Sydney, AU 2009-01/02; Brussels, BE 2009-03; Prague, CZ 2009-03
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(_at_)CraneSoftwrights(_dot_)com
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
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>