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  |  

Affordable ASP.NET Hosting Service
  Ads  
Iron Speed Designer is a software development tool for building database, reporting, and forms applications for .NET without hand-coding.
 


  Sponsors  

Meet Our Sponsors

MaximumASP
SourceGear - Tools for Developers
.: CounterSoft :.
telerik
ExactTarget email software solutions
Merak Mail Server
 


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
1551 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.

 


BataviaSoft DotNetNuke Solutions
BataviaSoft offers custom DotNetNuke solutions especially for the European and the South East Asian market.
www.bataviasoft.com
Viva Portals, L.L.C.
Expert module development and graphic design.
www.continure.com
DNN Photo Gallery
DNN Photo Gallery is a truly unique photo management module released January 1st 2006. With DNN Photo Gallery you can REALLY integrate images into your existing portal and make them look like they were designed for your site.
DNN Photo Gallery

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