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 ListFilter UDT when using User Defined XSL fileFilter UDT when using User Defined XSL file
Previous
 
Next
New Post
10/22/2007 2:31 AM
 

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 10:48 AM
 

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.

 

 
New Post
10/30/2007 11:05 AM
 

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
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListFilter UDT when using User Defined XSL fileFilter UDT when using User Defined XSL file


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