Subject: Re: [xsl] Need help with count expression|
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 31 Dec 2008 22:30:51 -0500
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 Basically 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 structure
<chapter> <p>...</p> <table class="topic/table"> <title class="table/title">(should resolve to Table 1.1) ...<title> ...
</table> <table class="topic/table>...</table>
<section> <table> ...</table>
<table> <title class="table/title">(should resolve to Table 1.2) ...<title> ... </table> </chapter> <chapter> <table class="topic/table>>...</table> <section>
<p> <table class="topic/table">
<title class="table/title">Should resolve to Table 2.1 </title> ... </table>
</p> </section> </chapter>
chapter number is easy enough 'count(preceding::chapter)+1' but what I'm having
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.
<xsl:number count="*[contains(@class,' topic/table ')] [*[contains(@class,' topic/title ')]]" from="chapter" level="any"/>
-- 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@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