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 QuestionXSLT Question
Previous
 
Next
New Post
2/16/2011 8:27 PM
 
My XSLT Sheet is great except I am trying to combine a couple of columns for list view and cannot figure out how to rename one of the column title fields only from within the XSL Sheet. The Field I am trying to change in the xsl sheet is  <xsl:apply-templates select="udt:Fields[udt:FieldTitle='Begin Date']" /> - I would like to change it to Date(s). Anybody know how to do this? Here's the code:

<?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:param name="param_orderby" select="//udt:Fields[udt:UserDefinedFieldId=//udt:Context/udt:OrderBy]/udt:SortColumn" />
<xsl:param name="param_direction" select="//udt:Context/udt:OrderDirection" />
<!--wrong string would break stylesheet, so fallback to ascending if userinput is wrong-->
<xsl:variable name="orderDirection">
<xsl:choose>
<xsl:when test="$param_direction='descending'">
<xsl:text>descending</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>ascending</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="orderType">
<xsl:variable name="DataType" select="//udt:Fields[udt:SortColumn=$param_orderby]/udt:FieldType" />
<xsl:choose>
<xsl:when test="$DataType='Int32' or $DataType='Decimal' or $DataType='Currency'">number</xsl:when>
<xsl:otherwise>text</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:template match="udt:Data" mode="list">
<tr class="Item">
<td class="EditLink">
<xsl:call-template name="EditLink" />
</td>
<td class="EventName">
<xsl:value-of select="udt:Event_x0020_Name" disable-output-escaping="yes" />
</td>
<td class="Address">
<xsl:value-of select="udt:Address" disable-output-escaping="yes" /> <xsl:value-of select="udt:City" disable-output-escaping="yes" />, <xsl:value-of select="udt:State" disable-output-escaping="yes" /> <xsl:value-of select="udt:Country" disable-output-escaping="yes" /></td>
<td class="DateSpan">
<xsl:value-of select="udt:Begin_x0020_Date_UDT_Value" disable-output-escaping="yes" /> - <xsl:value-of select="udt:End_x0020_Date_UDT_Value" disable-output-escaping="yes" /></td>
<td class="Website">
<xsl:value-of select="udt:Website" disable-output-escaping="yes" />
</td>
</tr>
</xsl:template>
<xsl:template match="/udt:UserDefinedTable">
<xsl:variable name="currentData" select="udt:Data" />
<xsl:if test="$currentData">
<table class="Itinerary">
<!-- DEFINE ANY HEADERS HERE, EXAMPLE IS FOR TABLE TYPE LISTING -->
<!-- Parameter header is optional! -->
<!--
<tr>
<td/>
<td class="NormalBold UDT_Table_Head">
<xsl:apply-templates select ="udt:Fields[udt:FieldTitle='NameOfColumn']">
<xsl:with-param name ="header" select ="NewHeaderName"/>
</xsl:apply-templates>
</td>...
</tr>
-->
<tr class="Header">
<td>
<xsl:call-template name="EditLink" />
</td>
<td>
<xsl:apply-templates select="udt:Fields[udt:FieldTitle='Event Name']" />
</td>
<td>
<xsl:apply-templates select="udt:Fields[udt:FieldTitle='Address']" />
</td>
<td>
<xsl:apply-templates select="udt:Fields[udt:FieldTitle='Begin Date']" />
</td>
<td>
<xsl:apply-templates select="udt:Fields[udt:FieldTitle='Website']" />
</td>
</tr>
<xsl:apply-templates select="$currentData" mode="list">
<xsl:sort select="*[name()=$param_orderby]" order="{$orderDirection}" data-type="{$orderType}" />
</xsl:apply-templates>
</table>
</xsl:if>
</xsl:template>
<xsl:template match="udt:Fields" name="SortingHeader">
<xsl:param name="header" select="udt:FieldTitle" />
<xsl:if test="udt:Visible='true' or udt:Visible='True'">
<a>
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="udt:ValueColumn=$param_orderby">
<xsl:variable name="flippedDirection">
<xsl:choose>
<xsl:when test="$orderDirection='ascending'">
<xsl:text>descending</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>ascending</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
?<xsl:value-of select="$prefix_param" />_orderby=<xsl:value-of select="udt:ValueColumn" />&amp;<xsl:value-of select="$prefix_param" />_direction=<xsl:value-of select="$flippedDirection" /></xsl:when>
<xsl:otherwise>
?<xsl:value-of select="$prefix_param" />_orderby=<xsl:value-of select="udt:ValueColumn" />&amp;<xsl:value-of select="$prefix_param" />_direction=<xsl:value-of select="$orderDirection" /></xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<!--flipped order direction-->
<xsl:value-of select="$header" />
<xsl:if test="udt:ValueColumn=$param_orderby">
<img src="{//udt:Context/udt:ApplicationPath}/images/sort{$orderDirection}.gif" border="0" />
</xsl:if>
</a>
</xsl:if>
</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
2/17/2011 8:25 AM
 
Replace line 109 (<xsl:value-of select="$header" />) with

<xsl:choose>
   <xsl:when test="[$header='Begin Date']">Date(s)</xsl:when>
   <xsl:otherwise><xsl:value-of select="$header" /></xsl:otherwise>
</xsl:choose>
 
New Post
2/17/2011 12:33 PM
 
Stefan,

Thank you for your quick reply and your expertise. I changed the code accordingly to try out your solution and I received the following message causing me to be unable to save the xslt sheet. Any thoughts or ideas? 

Here's the message I got: 
The Template is not well-formed:
The 'xsl:otherwise' start tag on line 111 does not match the end tag of 'xsl:choose'. Line 112, position 3.
 
New Post
2/17/2011 2:22 PM
 
I am a:
 

- i see the problem ;)

the closing xsl:otherwise is missing a / before it
 
New Post
2/17/2011 3:40 PM
 
Great Stefan, plugged everything in, added the / on the closing , removed the brackets around [$header='Begin Date'] and it works like a charm. I have one more question regarding the begin date. How would I go about omitting an entire row if it is not equal to or greater than today's date?
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListXSLT QuestionXSLT Question


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