View Single Post
  #1 (permalink)  
Old May 11th, 2006, 01:29 PM
daula7 daula7 is offline
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to daula7
Default Please help, xml transforming using xslt !!!

Hello everyone;
I have an xml that looks like the following:

---snip---

<dts>
<output>
<total name="test_t">
  <total name="cState">
    <total name="date_range">
      <value >00-06 </value>
      <count>21</count>
    </total>
    <total name="date_range">
      <value >07-12 </value>
      <count>26</count>
    </total>
    <total name="date_range">
      <value>13-24 </value>
      <count>34</count>
    </total>
    <value>AK</value>
    <count>81</count>
  </total>
  <total name="cState">
    <total name="date_range">
      <value >00-06 </value>
      <count>50</count>
    </total>
    <total name="date_range">
      <value >07-12 </value>
      <count>10</count>
    </total>
    <total name="date_range">
      <value>13-24 </value>
      <count>40</count>
    </total>
    <value>AR</value>
    <count>100</count>
  </total>
  .
  .
  .
</total>
</output>
</dts>

---snip---

my xslt follows:
-----------------
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
   <xsl:template match="/" >

   <xsl:text> _Total_ </xsl:text>
     <xsl:for-each select=
       "dts/output/total/total/total[generate-id(.)
       =generate-id(key('range',value))]">

       <xsl:value-of select="value"/>
       <xsl:text>: </xsl:text>
       <xsl:for-each select="key('range',value)">
          <xsl:value-of select="sum(count)"/>
          <xsl:text >,</xsl:text>
       </xsl:for-each>
     </xsl:for-each>

   </xsl:template>
</xsl:stylesheet>

----

I'm seeeking more help in using xslt for transformation/ retrieve data such that, to display the sum of "count" by "date_range" for all states.
For instance:

_Totals_
00-06 : 71
07-12 : 36

et cetera...

However, when I try to diplay the output... I'm getting a blank screen. I desperately need your help.
Please, note that I'm using xslt 1.0

Thanks in advance for your kind assistance

daula
Reply With Quote