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 ListXSLT SortingXSLT Sorting
Previous
 
Next
New Post
12/8/2011 9:35 AM
 

Hello..
I'm trying to get sorting working via the XSL sheet.  I'm using the F&L DataProvider for the Xml Module, and currently sorting within this isn't working properly and errors out.  (http://xmlproviders.codeplex.com/work...); (http://dnnxml.codeplex.com/workitem/2...
)

Some information about the form & list configuration:
- Date of Meeting is configured as a Date column
- Month and Year is a Text configured calculated column which takes two other text columns (Month & Year) and combines them

The XSL style is configured so it groups the meeting minutes by Month and Year; E.g.
   January 2011 
      January 1st, 2011
      January 5th, 2011
   February 2011 
      February 3rd, 2011
      February 7th, 2011

But, I'm also trying to get the sub-minute items to sort by their meeting minutes date; ().  But, the sorting isn't fully working properly.  It's almost as if it's sorting by the created/update date instead.  E.g.  If I add a February 2nd meeting minute, it'll show up below the February 7th meeting minute instead or it's proper location event thought I set the Date of Meeting for the entry to 2/2/2011.

If I change the sort order from ascending to descending, then it'll change the sort order of the months instead; November, October, September, August instead of August, September, October, November.

Any ideas?  Thanks.. -Jeff

Main area of sorting and displaying information:

<ul>
  <xsl:for-each select="$DepartmentData[count(. | key('data-by-date', udt:Month_x0020_and_x0020_Year)[1]) = 1]">
  <xsl:sort select="udt:Date_x0020_of_x0020_Meeting_UDT_Value" order="ascending" />
  <li>
<xsl:variable name="currentData" select="key('data-by-date', udt:Month_x0020_and_x0020_Year)" />
<xsl:if test="$currentData">
 <xsl:value-of select="udt:Month_x0020_and_x0020_Year" disable-output-escaping="yes" />
 <ul>
<xsl:apply-templates select="$currentData" mode="list">
</xsl:apply-templates>
 </ul>
</xsl:if>
  </li>
  </xsl:for-each>
</ul>

Full XSL Sheet:

<?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:key name="data-by-department" match="udt:Data" use="udt:Department" />
  <xsl:key name="data-by-date" match="udt:Data" use="udt:Month_x0020_and_x0020_Year" />


  <xsl:template match="udt:Data" mode="list">
    <li>
 <xsl:value-of select="udt:Minutes" disable-output-escaping="yes" />&#160;<xsl:call-template name="EditLink" />
</li>
  </xsl:template>


  <xsl:template match="/udt:UserDefinedTable">
    <xsl:for-each select="udt:Data[count(. | key('data-by-department', udt:Department)[1]) = 1]">
      <xsl:variable name="DepartmentData" select="key('data-by-department', udt:Department)" />
        <p style="line-height: 22px; font-size: 18px; font-weight: bold; text-align: justify;text-transform:uppercase;padding: 0">
          <xsl:value-of select="udt:Department" disable-output-escaping="yes" />&#160;MINUTES
        </p>
        <xsl:choose>
          <xsl:when test="$DepartmentData">
            <ul>
              <xsl:for-each select="$DepartmentData[count(. | key('data-by-date', udt:Month_x0020_and_x0020_Year)[1]) = 1]">
              <xsl:sort select="udt:Date_x0020_of_x0020_Meeting_UDT_Value" order="ascending" />
              <li>
                <xsl:variable name="currentData" select="key('data-by-date', udt:Month_x0020_and_x0020_Year)" />
                <xsl:if test="$currentData">
                  <xsl:value-of select="udt:Month_x0020_and_x0020_Year" disable-output-escaping="yes" />
                  <ul>
                    <xsl:apply-templates select="$currentData" mode="list">
                    </xsl:apply-templates>
                  </ul>
                </xsl:if>
              </li>
              </xsl:for-each>
            </ul>
          </xsl:when>
          <xsl:otherwise>
            <table align="center" width="90%">
              <tr>
                <td>
                  <br/><br/><strong>There are no meeting miuntes at this time.</strong><br/>
                  Please check back soon.
                </td>
              </tr>
            </table>
          </xsl:otherwise>
        </xsl:choose>
</xsl:for-each>
  </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
12/8/2011 11:19 AM
 
Jeff,
Please change 
  <xsl:apply-templates select="$currentData" mode="list">
  </xsl:apply-templates>
to
  <xsl:apply-templates select="$currentData" mode="list">
     <xsl:sort select="udt:Date_x0020_of_x0020_Meeting_UDT_Value" order="ascending" />
  </xsl:apply-templates>

Did you report the sorting error for the XML data provider? If yes, please add some steps to reproduce the issue.

Thanks,
Stefan

 
New Post
12/8/2011 12:05 PM
 

Did you report the sorting error for the XML data provider? If yes, please add some steps to reproduce the issue.

Thanks,
Stefan

Awesome!

What you posted worked like a charm.  Didn't think of nor did I try to put the sort within the apply-templates area; DOH!  Fixed other issues which I was having with our other F&L pages and sorting.  Thanks!

Yea, for the XML Data Provider, I opened a ticket on the issue and I've tried a number of different things to get the sorting to work.  If I put anything in on the sort field field (column name, [column name], udt:column name), it bombs out with the error I describe in the ticket (http://xmlproviders.codeplex.com/work...).  Sorting within the XSL sheet resolves this for the time being.

Thank you again for all your hard work to make the F&L module one of the best and most powerful modules within the DNN core.  The more I work with and use it, the more things I find to make life easier for entering information.

Especially when the end-user isn't strong in simple HTML and messes up a simple HTML table.  Create the F&L, do all the formatting within the XSLT and they just have to fill-out a simple form and it's done.  Then for archives pages or for only displaying certain information, reference the main F&L module and with the use of the filtering logic, it resolves a lot of issues.  This leads to less administration by our main web developer.

Thanks.. -Jeff

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListXSLT SortingXSLT Sorting


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