Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListTotaling ColumnsTotaling Columns
Previous
 
Next
New Post
8/29/2011 12:49 PM
 
Hello..
I'm trying to get the grand total of all the columns using XSLT.  This this possible and how would I accomplish this?

Location 1 200
Location 2 300
Locaiton 3 50
Grand Total 550 

Thanks.. -Jeff
 
New Post
8/29/2011 3:15 PM
 
Jeff, try <xsl:value-of select="sum(//udt:data/udt:fieldname)">
 
New Post
8/30/2011 10:09 AM
 
Hello Stefan,
Thank you for the reply.
I tried what you suggested, but it's reporting '0' as the sum.
Not sure why isn't not working properly.  The columns I'm trying to add, etc are integers.
Thanks.. -Jeff

Below is the XSL code I'm trying to use.

Template:
  <td>
    <xsl:value-of select="format-number(udt:Population, '#,###.##')" disable-output-escaping="yes" />
  </td>

Below the Apply-Template:
  <td class="TopRow">
    <xsl:value-of select="sum(//udt:data/udt:Population)" />
  </td>
 
New Post
8/30/2011 10:48 AM
 
Jeff, I was wrong in caplitalization, it is udt:Data, not udt.data....
 
New Post
8/31/2011 8:38 AM
 
Hello Stefan..
Thank you again for your reply..  I was able to get everything working properly..
For anyone which is wondering how the final XSL looks, see below.  -Jeff
____________________________________________________________
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:udt="DotNetNuke/UserDefinedTable" exclude-result-prefixes="udt">
  <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
  <!--
  This prefix is used to generate module specific query strings
  Each querystring or form value that starts with udt_{ModuleId}_param 
  will be added as parameter starting with param
  -->
  <xsl:variable name="prefix_param">udt_<xsl:value-of select="//udt:Context/udt:ModuleId" />_param</xsl:variable>


  <xsl:template match="udt:Data" mode="list">
    <tr class="Normal">
      <td class="LeftRow">
        <xsl:call-template name="EditLink" />&#160;
        <xsl:value-of select="udt:Community" disable-output-escaping="yes" /></td>
      <td>
        <xsl:value-of select="format-number(udt:Population, '#,###.##')" disable-output-escaping="yes" />
      </td>
      <td>
        <xsl:value-of select="format-number(udt:Male, '#,###.##')" disable-output-escaping="yes" />
      </td>
      <td>
        <xsl:value-of select="format-number(udt:Female, '#,###.##')" disable-output-escaping="yes" />
      </td>
      <td>
        <xsl:value-of select="format-number(udt:Total_x0020_Households, '#,###.##')" disable-output-escaping="yes" />
      </td>
      <td>
        <xsl:value-of select="format-number(udt:Average_x0020_Household_x0020_Size, '#,###.##')" disable-output-escaping="yes" />
      </td>
      <td>
        <xsl:value-of select="format-number(udt:Total_x0020_Families, '#,###.##')" disable-output-escaping="yes" />
      </td>
      <td>
        <xsl:value-of select="format-number(udt:Average_x0020_Family_x0020_Size, '#,###.##')" disable-output-escaping="yes" />
      </td>
    </tr>
  </xsl:template>


  <xsl:template match="/udt:UserDefinedTable">
    <xsl:variable name="currentData" select="udt:Data" />
    <xsl:if test="$currentData">
      <table class="CensusTable" border="1">
        <tr>
          <td style="border-color: #ffffff;">
            &#160;
          </td>
          <td class="TopRow">
            Population
          </td>
          <td class="TopRow">
            Male
          </td>
          <td class="TopRow">
            Female
          </td>
          <td class="TopRow">
            Total Households
          </td>
          <td class="TopRow">
            Average Household Size
          </td>
          <td class="TopRow">
            Total Families
          </td>
          <td class="TopRow">
            Average Family Size
          </td>
        </tr>
        <xsl:apply-templates select="$currentData" mode="list">
        </xsl:apply-templates>
        <tr>
          <td class="LeftRow">
            Totals
          </td>
          <td>
              <xsl:value-of select="format-number(sum(//udt:Data/udt:Population), '#,###.##')" />
          </td>
          <td>
              <xsl:value-of select="format-number(sum(//udt:Data/udt:Male), '#,###.##')" />
          </td>
          <td>
              <xsl:value-of select="format-number(sum(//udt:Data/udt:Female), '#,###.##')" />
          </td>
          <td>
              <xsl:value-of select="format-number(sum(//udt:Data/udt:Total_x0020_Households), '#,###.##')" />
          </td>
          <td>
              <xsl:value-of select="format-number((sum(//udt:Data/udt:Population)) div (sum(//udt:Data/udt:Total_x0020_Households)), '#,###.##')" />
          </td>
          <td>
              <xsl:value-of select="format-number(sum(//udt:Data/udt:Total_x0020_Families), '#,###.##')" />
          </td>
          <td>
              <xsl:value-of select="format-number((sum(//udt:Data/udt:Population)) div (sum(//udt:Data/udt:Total_x0020_Families)), '#,###.##')" />
          </td>
        </tr>
      </table>
    </xsl:if>
  </xsl:template>


  <xsl:template name="EditLink">
    <xsl:if test="udt:EditLink">
      <a href="{udt:EditLink}">
        <img border="0" alt="edit" src="{//udt:Context/udt:ApplicationPath}/images/edit.gif" />
      </a>
    </xsl:if>
  </xsl:template>
</xsl:stylesheet>
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListTotaling ColumnsTotaling Columns


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out