I am not familiar with XSLT very well, and I need help modifying our current XSLT file.
Current Table Structure:
1) Group (Text)
2) Name (Text)
3) Title (Text)
4) EMail (Text)
5) Phone (Text)
|
New Table Structure:
1) GroupOrderIndex (Integer)
2) Group (Text)
3) OrderIndex (Integer)
4) FirstName (Text)
5) LastName (Text)
6) Title (Text)
7) EMail (Text)
8) Phone (Text)
|
Sample Data (Using New Table Structure):
Currently my script groups by "Group", and then displays the data using the defined template.
I am changing the structure to split the "Name" into "First" and "Last" and I am adding an "OrderIndex" field.
I need to do the following:
1) Group by "GroupOrderIndex, Group" and then sort by "OrderIndex, Lastname, FirstName".
2) When displaying the name I need to concatanate FirstName and LastName into one column
Can someone help me modify my current XSLT to do this?
<?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:key name="data-by-group" match="udt:Data" use="udt:Group" />
<xsl:template match="udt:Data" mode="list">
<tr class="Normal">
<td>
<xsl:call-template name="EditLink" />
</td>
<td Width="200px">
<xsl:value-of select="udt:Name" disable-output-escaping="yes" />
</td>
<td Width="300px">
<xsl:value-of select="udt:Title" disable-output-escaping="yes" />
</td>
<td Width="20px" />
<td>
<xsl:value-of select="udt:EMail" disable-output-escaping="yes" />
</td>
<td>
<xsl:value-of select="udt:Phone" disable-output-escaping="yes" />
</td>
</tr>
</xsl:template>
<xsl:template match="/udt:UserDefinedTable">
<table Width="100%" style="border-collapse:collapse;">
<xsl:for-each select="udt:Data[count(. | key('data-by-group', udt:Group)[1]) = 1]">
<xsl:sort select="udt:Group" />
<xsl:variable name="currentData" select="key('data-by-group', udt:Group)" />
<xsl:if test="$currentData">
<tr style="border-bottom-width:thin;border-bottom-style:dashed;font-weight:bold">
<td colspan="5" Height="28px" Style="vertical-align:bottom">
<xsl:value-of select="udt:Group" disable-output-escaping="yes" />
</td>
</tr>
<tr class="Normal" style="font-weight:bold">
<td />
<td>Name</td>
<td>Title</td>
<td />
<td>E-Mail</td>
<td>Phone</td>
</tr>
<xsl:apply-templates select="$currentData" mode="list">
</xsl:apply-templates>
</xsl:if>
</xsl:for-each>
</table>
</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>