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

Need help with count expression

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

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-2011 All Rights Reserved.