[xsl] Need help with count expression

Subject: [xsl] Need help with count expression
From: Kit Strong <kit@xxxxxxxxxxxxxxxxxx>
Date: Wed, 31 Dec 2008 12:47:50 -0800 (PST)
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 

        <title class="table/title">(should 
resolve to Table 1.1) ...<title>
     <table class="topic/table>...</table>
       <table> ...</table>
            <title class="table/title">(should resolve to 
Table 1.2) ...<title>
            <table class="topic/table">
<title class="table/title">Should resolve to Table 2.1 
Getting the 
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 
select="count(preceding::*[contains(@class,' topic/table 
')]/*[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 
current <chapter>
Any help would be much appreciated.

Current Thread