Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 17th, 2007, 11:14 AM
dep dep is offline
Authorized User
 
Join Date: Oct 2006
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dep
Default Using axis instead of count? Counting child nodes.

Hello. I have the following xml, basically.

Code:
  <data>
    <risk>
      <personVal/>
      <description>Total</description>
      <last/>
      <numVal/>
      <quantity/>
      <testVal>470400.42</testVal>
      <totals>220421.73</totals>
      <totalmade>232356.69</totalmade>
      <dailymade>139.21</dailymade>
      <ling>1223.00</ling>
      <risk>
        <personVal>Consumer</personVal>
        <description/>
        <last/>
        <numVal/>
        <quantity/>
        <testVal>215892.50</testVal>
        <totals>537.00</totals>
        <totalmade>132062.50</totalmade>
        <dailymade>85.51</dailymade>
        <ling>34.96</ling>
        <risk>
          <personVal>Consumer</personVal>
          <description>MMM</description>
          <last/>
          <numVal/>
          <quantity/>
          <testVal>215760.00</testVal>
          <totals>462.00</totals>
          <totalmade>132060.00</totalmade>
          <dailymade>68.01</dailymade>
          <ling>34.96</ling>
          <risk>
            <personVal/>
            <description>MMM Jan 07 60.00 Call</description>
            <last>19.00</last>
            <numVal>-0.60</numVal>
            <quantity>-22.00</quantity>
            <testVal>41800.00</testVal>
            <totals>121.00</totals>
            <totalmade>-41679.00</totalmade>
            <dailymade>1320.00</dailymade>
            <ling>-2200.00</ling>
          </risk>
          <risk>
            <personVal/>
            <description>MMM Apr 07 70.00 Put</description>
            <last>0.40</last>
            <numVal>0.05</numVal>
            <quantity>-4.00</quantity>
            <testVal>160.00</testVal>
            <totals>220.00</totals>
            <totalmade>60.00</totalmade>
            <dailymade>-20.00</dailymade>
            <ling>34.96</ling>
          </risk>
          <risk>
            <personVal/>
            <description>MMM Stock</description>
            <last>78.99</last>
            <numVal>-0.56</numVal>
            <quantity>2200.00</quantity>
            <testVal>173800.00</testVal>
            <totals>121.00</totals>
            <totalmade>173679.00</totalmade>
            <dailymade>-1231.99</dailymade>
            <ling>2200.00</ling>
          </risk>
        </risk>
      </risk>
    </risk>
  </data>
I would like to be able to use axis to count the TOTAL number of children in each row INSTEAD of using <xsl:value-of select="count(risk) + count(risk/risk)"/>

Kinda n00b with the axis stuff. Any help is appreciated!

Reply With Quote
  #2 (permalink)  
Old January 17th, 2007, 11:27 AM
dep dep is offline
Authorized User
 
Join Date: Oct 2006
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dep
Default

got it.. fyi:
<xsl:value-of select="count(descendant::risk)"/>


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting Child Records BrianWren VB Databases Basics 1 June 2nd, 2008 04:32 PM
Counting Nodes That Are Not Empty tommyready XSLT 2 September 4th, 2007 09:03 AM
Counting leaf nodes by transforming their value dmorin XSLT 3 June 29th, 2007 04:58 AM
Counting nodes on output bonekrusher XSLT 6 February 26th, 2007 08:19 PM
counting child nodes Tomi XSLT 1 September 6th, 2006 03:26 AM



All times are GMT -4. The time now is 07:44 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.