p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   Please help, xml transforming using xslt !!! (http://p2p.wrox.com/showthread.php?t=42425)

daula7 May 11th, 2006 01:29 PM

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


All times are GMT -4. The time now is 05:34 AM.

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