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

Adding the results of count()

Subject: Adding the results of count()
From: charlieo0@xxxxxxxxxxx
Date: Mon, 22 Nov 2010 19:05:28 +0000 (UTC)
 Adding the results of count()
I could use some help taking the results of counting all of the elements in set of documents, then adding all those counts together.

What I've written, of course, creates a text documents that lists the source document and how many graphic elements are in each particular document. My question, how can I take the results of the count and add them up using the sum() function. Or can I even do that?

Of course, I can always open the result document and add them up with a calculator, but I'd like to be a bit more elegant and learn something in the process. Thanks for any assistance.



    <xsl:param name="collection" select="collection('file:/C:/documents/?select=*.xml')"/>
    
    <xsl:template match="/">
        <xsl:result-document method="text" href="file:/C:/results/graphic_Count.txt">
        <xsl:for-each select="$collection">
            <xsl:value-of select="base-uri(.)"/><xsl:text>  ---   </xsl:text>
                <xsl:value-of select="local-name()"/>
                <xsl:value-of select="count(descendant::graphic)"/>
            <xsl:text>&#x0A;</xsl:text>
        </xsl:for-each>
    </xsl:result-document>
  
    </xsl:template>



Charlie

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