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 ListSearch in User Defined XSL TransformationSearch in User Defined XSL Transformation
Previous
 
Next
New Post
3/23/2009 1:49 AM
 

I am fairly new to XSL, and was wondering if someone may be able to help.

I am using UDT 3.5.1, on DNN 4.9.2.  I have used XSLT Generator to turn my HTML template into a XSLT script.  One thing I am having diffuiculty with is the search facilities, and setting them up inside the XSLT.

If a user does a search, I want them to see ONLY the number they type in, rather than other entries that also contain that number (i.e. if they enter "1234", I only want to show entry number "1234", and not have the user also see "12345" and "123456", which is what is happening at the moment).  When using the default table, I have the abiity to set search to work in an "equals" mode.  This gives the result that I want.

However, when I go to my XSLT script, the search is working in the "contains" mode.  Are there any parameters I can put into the XSLT to make the search work in "equals" mode?

 
New Post
3/23/2009 6:27 AM
 

Yes, just write A = B  instead of contains(A,B)

 
New Post
3/30/2009 12:51 AM
 

Thanks for your help.  As mentioned earlier, I am very new to XSL, and have tried changing elements of the XSL script, but all generate errors.  What part of the following script do I have to change to make it so as A=B?

 

<?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:template match="udt:Data" mode="list">
    <table width="400" border="0" cellspacing="0" cellpadding="5" class="Normal">
      <tr>
        <td width="1%" align="right" valign="top">
          <strong>Con Note:</strong>
        </td>
        <td width="11%" align="left" valign="top">
          <xsl:value-of select="udt:Con_x0020_Note_x0020_Number" disable-output-escaping="yes" />
          <xsl:call-template name="EditLink" />
        </td>
      </tr>
      <tr>
        <td align="right" valign="top">
          <strong>Sender:</strong>
        </td>
        <td align="left" valign="top">
          <xsl:value-of select="udt:Sender" disable-output-escaping="yes" />
        </td>
      </tr>
      <tr>
        <td align="right" valign="top">
          <strong>Dispatched:</strong>
        </td>
        <td align="left" valign="top">
          <xsl:value-of select="udt:Dispatched_UDT_Value" disable-output-escaping="yes" />
        </td>
      </tr>
      <tr>
        <td align="right" valign="top">
          <strong>Recipient:</strong>
        </td>
        <td align="left" valign="top">
          <xsl:value-of select="udt:Receiver" disable-output-escaping="yes" />
        </td>
      </tr>
      <tr>
        <td align="right" valign="top">
          <strong>Location:</strong>
        </td>
        <td align="left" valign="top">
          <xsl:value-of select="udt:Location" disable-output-escaping="yes" />
        </td>
      </tr>
      <tr>
        <td align="right" valign="top">
          <strong>ETA:</strong>
        </td>
        <td align="left" valign="top">
          <xsl:value-of select="udt:ETA_UDT_Value" disable-output-escaping="yes" />
        </td>
      </tr>
      <tr>
        <td align="right" valign="top">
          <strong>Delivery Agent:</strong>
        </td>
        <td align="left" valign="top">
          <xsl:value-of select="udt:Deligated_x0020_Agent" disable-output-escaping="yes" />
        </td>
      </tr>
      <tr>
        <td align="right" valign="top">
          <strong>Agent Ref:</strong>
        </td>
        <td align="left" valign="top">
          <xsl:value-of select="udt:Agent_x0020_Ref_x0020_Number" disable-output-escaping="yes" />
        </td>
      </tr>
      <tr>
        <td align="right" valign="top">
          <strong>Status:</strong>
        </td>
        <td align="left" valign="top">
          <xsl:value-of select="udt:Status" disable-output-escaping="yes" />
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="/udt:UserDefinedTable">
    <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)]" />
    <xsl:apply-templates select="$currentData" mode="list">
    </xsl:apply-templates>
  </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:stylesheet>

 
New Post
3/30/2009 2:03 AM
 

You have to change that part:

<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)]" />

The exact change depends again on the settings (definition which colums should be searchable).

Example:

<xsl:variable name="currentData" select="udt:Data[udt:Agent_x0020_Ref_x0020_Number=$search]" />

 

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListSearch in User Defined XSL TransformationSearch in User Defined XSL Transformation


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