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 ListNeed some xsl Grouping help...Need some xsl Grouping help...
Previous
 
Next
New Post
6/14/2010 8:11 PM
 
ok there is something i am missing... I am trying to group Ministry_Area field and use that same field as a group title. I have to be missing something simple.  Anyone able to spot it?   Obviously there is more to this xsl but this is the entire udt:Data section and the  key is close to the top

<xsl:key name="Min_Area_key" match="udt:Data" use="udt:Ministry_Area" />


<
xsl:template match="udt:Data" mode="list">
   <xsl:for-each select="udt:Data[count(. | key('Min_Area_key', udt:Ministry_Area)[1]) = 1]">
     <xsl:sort select="udt:Ministry_Area" />
     <tr>
       <td colspan="2">
         <xsl:value-of select="udt:Ministry_Area" disable-output-escaping="yes" />
       </td>
     </tr>
     <xsl:for-each select="key('Min_Area_key', udt:Ministry_Area)">
       <xsl:sort select="Title" />
       <tr class="Normal">
         <td colspan="2">
           <xsl:call-template name="EditLink" />   <a href="{udt:Link_UDT_Url}"><span class="h2"><xsl:value-of select="udt:Title" disable-output-escaping="yes" /></span></a></td>
       </tr>
       <tr>
         <td>
           <xsl:value-of select="udt:Thumbnail_IMG" disable-output-escaping="yes" />
         </td>
         <td>
           <span class="normal">
             <xsl:value-of select="udt:Mini_Text" disable-output-escaping="yes" />
           </span>
         </td>
       </tr>
       <tr>
         <td colspan="2"> </td>
       </tr>
     </xsl:for-each>
   </xsl:for-each>
 </xsl:template>
 
New Post
6/15/2010 3:42 AM
 
What is going wrong with your script? The only issue I see is a missing udt: at xsl:sort select="Title"
 
New Post
6/15/2010 10:32 AM
 
I have reduced the script to eliminate possible typos.  The data is showing with no grouping, but as soon as i put the grouping back in.. I get blank data.  This code does (not) produce grouping, but for the life of me.. i cant see why

<?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:param name="param_orderby" select="//udt:Fields[udt:UserDefinedFieldId=//udt:Context/udt:OrderBy]/udt:SortColumn" />
  <xsl:param name="param_direction" select="//udt:Context/udt:OrderDirection" />
  <!--wrong string would break stylesheet, so fallback to ascending if userinput is wrong-->
  <xsl:variable name="orderDirection">
    <xsl:choose>
      <xsl:when test="$param_direction='descending'">
        <xsl:text>descending</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>ascending</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="orderType">
    <xsl:variable name="DataType" select="//udt:Fields[udt:SortColumn=$param_orderby]/udt:FieldType" />
    <xsl:choose>
      <xsl:when test="$DataType='Int32' or $DataType='Decimal' or $DataType='Currency'">number</xsl:when>
      <xsl:otherwise>text</xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:key name="Min_Area" match="udt:Data" use="udt:Ministry_Area" />
  
  <xsl:template match="udt:Data" mode="list">
    <xsl:for-each select="udt:Data[count(. | key('Min_Area', udt:Ministry_Area)[1]) = 1]">
      <tr>
        <td>
          <xsl:value-of select="udt:Ministry_Area" disable-output-escaping="yes" />
        </td>
      </tr>
    </xsl:for-each>
  </xsl:template>
  
  <xsl:template match="/udt:UserDefinedTable">
    <xsl:variable name="currentData" select="udt:Data" />
    <xsl:if test="$currentData">
      <table>
        <!-- DEFINE ANY HEADERS HERE, EXAMPLE IS FOR TABLE TYPE LISTING -->
        <!-- Parameter header is optional! -->
        <!--
      <tr>
        <td/>
        <td class="NormalBold UDT_Table_Head">
          <xsl:apply-templates select ="udt:Fields[udt:FieldTitle='NameOfColumn']">
            <xsl:with-param name ="header" select ="NewHeaderName"/>
          </xsl:apply-templates>
        </td>...
      </tr>
      -->
        <xsl:apply-templates select="$currentData" mode="list">
          <xsl:sort select="*[name()=$param_orderby]" order="{$orderDirection}" data-type="{$orderType}" />
        </xsl:apply-templates>
      </table>
    </xsl:if>
  </xsl:template>
  
  <xsl:template match="udt:Fields" name="SortingHeader">
    <xsl:param name="header" select="udt:FieldTitle" />
    <xsl:if test="udt:Visible='true' or udt:Visible='True'">
      <a>
        <xsl:attribute name="href">
          <xsl:choose>
            <xsl:when test="udt:ValueColumn=$param_orderby">
              <xsl:variable name="flippedDirection">
                <xsl:choose>
                  <xsl:when test="$orderDirection='ascending'">
                    <xsl:text>descending</xsl:text>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:text>ascending</xsl:text>
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:variable>
      ?<xsl:value-of select="$prefix_param" />_orderby=<xsl:value-of select="udt:ValueColumn" />&<xsl:value-of select="$prefix_param" />_direction=<xsl:value-of select="$flippedDirection" /></xsl:when>
            <xsl:otherwise>
              ?<xsl:value-of select="$prefix_param" />_orderby=<xsl:value-of select="udt:ValueColumn" />&<xsl:value-of select="$prefix_param" />_direction=<xsl:value-of select="$orderDirection" /></xsl:otherwise>
          </xsl:choose>
        </xsl:attribute>
        <!--flipped order direction-->
        <xsl:value-of select="$header" />
        <xsl:if test="udt:ValueColumn=$param_orderby">
          <img src="{//udt:Context/udt:ApplicationPath}/images/sort{$orderDirection}.gif" border="0" />
        </xsl:if>
      </a>
    </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>
 
New Post
6/15/2010 3:18 PM
 
The issue is here:
<xsl:template match="udt:Data" mode="list">
    <xsl:for-each select="udt:Data[count(. | key('Min_Area', 
This code looks for  udt:Data/udt:Data
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListNeed some xsl Grouping help...Need some xsl Grouping help...


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