Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

telerik -- supercharge your DNN websites
  Ads  
Webhost4Life - $4.95 Windows Hosting
 


  Sponsors  

Meet Our Sponsors

Merak Mail Server
WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
Salaro -- Skins and more
OnyakTech
The best choice for your web site host, email hosting, and domain registration.
 


DotNetNuke Forums
 
  Forum  DotNetNuke® Pro...  User Defined Ta...  Filter UDT when using User Defined XSL file
Previous Previous
 
Next Next
New Post 10/22/2007 12:31 AM
User is offline j_ruez
49 posts
www.tennesseewrestling.com
10th Ranked


Filter UDT when using User Defined XSL file 

I have created a User Defined XSL file for the display of my UDT, but I cannot figure out how to filter the records.  If I use the Default Grid Table, there is a field for filtering. 

How do you filter when creating an XSL?

thanks,  -- jarrod

 
New Post 10/24/2007 8:48 AM
User is offline Stefan Cullmann
1553 posts
5th Ranked








Re: Filter UDT when using User Defined XSL file 

You need to write a XPath statement.
For example, if you have a column "Year" and you want to see only records with Year=2007, it would be udt:Data[udt:Year='2007'].
You place that statement to the match/select attribute of you xsl:foreach or xsl:template statement.

If you use the token2xsl generator, look for the line 
<xsl:variable name="currentData" select="udt:Data" />
this would be 
<xsl:variable name="currentData" select="udt:Data[udt:Year='2007']" />
afterwards.

 


Stefan Cullmann - stefan.cullmann [at] dotnetnuke.com
form and List will be the successor of the User Defined Table module.
----------------------------------------------------------------------
Do you want to import external data to form and List /User Defined Table?
Check out http://www.codeplex.com/Csv2UDTImport
 
New Post 10/30/2007 9:05 AM
User is offline fprati
36 posts
10th Ranked


Re: Filter UDT when using User Defined XSL file 

Hello,

I tried to follow your example and modify the xsl file that the system has generated from the html table, I made a several attempts but I could not succeed. What I am trying to do is to select in the main view (list view?) only those records where [Sector='abc'] (with sector not appaering in that view, btw, but only in the detailed view). I would be grateful is someone coudl help me. The content of the file follows:

<?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">
  <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_search" />
  <xsl:param name="param_searchpostback" />
  <xsl:param name="param_ispostback" />
  <xsl:variable name="search">
    <xsl:choose>
      <xsl:when test="$param_ispostback">
        <xsl:value-of select="$param_searchpostback" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$param_search" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:param name="param_detail" />

  <xsl:template match="udt:Data" mode="detail">
    <xsl:call-template name="ListView" />
    <xsl:call-template name="EditLink" />
    <table>
      <tr>
        <td>
          <h2>
            <xsl:value-of select="udt:Title" disable-output-escaping="yes" />
          </h2>
        </td>
        <td class="normal">
          <xsl:value-of select="udt:Consultant" disable-output-escaping="yes" />
        </td>
      </tr>
      <tr>
        <td class="normalBold">Sector</td>
        <td class="Submenu">
          <xsl:value-of select="udt:Sector" disable-output-escaping="yes" />
        </td>
      </tr>
      <tr>
        <td class="normalBold">Headline</td>
        <td class="normalBold">
          <xsl:value-of select="udt:Headline" disable-output-escaping="yes" />
        </td>
      </tr>
      <tr>
        <td class="normalBold">Description</td>
        <td class="normal">
          <xsl:value-of select="udt:Description" disable-output-escaping="yes" />
        </td>
      </tr>
      <tr>
        <td class="normalBold">Address</td>
        <td class="normal">
          <xsl:value-of select="udt:Address" disable-output-escaping="yes" />
        </td>
      </tr>
      <tr>
        <td class="normalBold">Country</td>
        <td class="normal">
          <xsl:value-of select="udt:Country" disable-output-escaping="yes" />
        </td>
      </tr>
      <tr>
        <td class="normalBold">State</td>
        <td class="normal">
          <xsl:value-of select="udt:State" disable-output-escaping="yes" />
        </td>
      </tr>
      <tr>
        <td class="normalBold">email</td>
        <td class="normal">
          <xsl:value-of select="udt:email" disable-output-escaping="yes" />
        </td>
      </tr>
      <tr>
        <td class="normalBold">Website</td>
        <td class="normal">
          <xsl:value-of select="udt:Website" disable-output-escaping="yes" />
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="udt:Data" mode="list">
    <tr class="normal">
      <td>
        <xsl:call-template name="DetailView" />
      </td>
      <td>
        <xsl:value-of select="udt:Consultant" disable-output-escaping="yes" />
      </td>
      <td>
        <h2>
          <xsl:value-of select="udt:Title" disable-output-escaping="yes" />
        </h2>
      </td>
      <td>
        <xsl:value-of select="udt:Headline" disable-output-escaping="yes" />
      </td>
    </tr>
  </xsl:template>

  <xsl:template match="/udt:UserDefinedTable">
    <xsl:choose>
      <xsl:when test="$param_detail">
        <!--master-detail view-->
        <xsl:apply-templates select="udt:Data[udt:UserDefinedRowId=$param_detail]" mode="detail" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:variable name="searchColumns" select="//udt:Fields[udt:Searchable='true']/udt:ValueColumn" />
        <xsl:if test="//udt:Fields[udt:Searchable='true']">
          <xsl:call-template name="Searchform" />
        </xsl:if>
        <xsl:variable name="currentData" select="udt:Data[contains(*[name()=$searchColumns][1],$search) or contains(*[name()=$searchColumns][2],$search) or contains(*[name()=$searchColumns][3],$search) or contains(*[name()=$searchColumns][4],$search) or contains(*[name()=$searchColumns][5],$search)]" />
        <table>
          <xsl:apply-templates select="$currentData" mode="list">
          </xsl:apply-templates>
        </table>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="Searchform">
    <input type="text" name="{$prefix_param}_searchPostback" value="{$search}" />
    <input type="submit" name="go" value="{//udt:Context/udt:LocalizedString_Search}" />
    <input type="hidden" name="{$prefix_param}_ispostback" value="true" />
  </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:template name="ListView">
    <a href="{//udt:Context/udt:ApplicationPath}/tabid/{//udt:Context/udt:TabId}/Default.aspx">
      <img border="0" alt="Back" src="{//udt:Context/udt:ApplicationPath}/images/lt.gif" />
    </a>
  </xsl:template>

  <xsl:template name="DetailView">
    <a href="?{$prefix_param}_detail={udt:UserDefinedRowId}">
      <img border="0" alt="detail" src="{//udt:Context/udt:ApplicationPath}/images/view.gif" />
    </a>
  </xsl:template>
</xsl:stylesheet>

 
Previous Previous
 
Next Next
  Forum  DotNetNuke® Pro...  User Defined Ta...  Filter UDT when using User Defined XSL file
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


IHostASP.NET Provides the Ideal DNN Hosting
We will help you with the installation, configuration, and troubleshooting of your DNN portal, no task is too big or small for us. Unlike other companies we are not just providing a reliable hosting service, but we are also focused on providing the best DotNetNuke hosting service on the internet.
www.ihostasp.net
$7.16/mo - Powerful DotNetNuke / DNN Hosting
Powerful DotNetNuke / DNN Hosting on Windows 2008 and 2003 servers, starting at under $8/mo with FREE SQL 2008 on certain plans and FREE SQL 2005 on all plans with FREE Installation and expert support.
www.re-invent.com
ASP.NET Web Hosting for $3.95
3 Month FREE ASP.NET Hosting! FREE Setup! DNN Support! FREE Domain Name! FREE Components! Host multiple websites on 1 plan! 30 Days Money Back Guarantee!
www.dailyrazor.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP