<?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_detail" />

  <xsl:template match="udt:Data" mode="detail">
    <table>
      <tr>
        <td class="Normal">
          <xsl:value-of select="udt:Body" disable-output-escaping="yes" />
          <xsl:call-template name="ListView" />
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="udt:Data" mode="list">
    <tr class="Normal">
      <td>
        <xsl:call-template name="EditLink" />
      </td>
      <td class="news_sepsrstor">
        <xsl:value-of select="udt:Title" disable-output-escaping="yes" />
        <xsl:call-template name="DetailView" />
      </td>
      <td class="news_sepsrstor">
        <xsl:value-of select="udt:Img" 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="currentData" select="udt:Data" />
        <xsl:if test="$currentData">
          <table>
            <xsl:apply-templates select="$currentData" mode="list">
            </xsl:apply-templates>
          </table>
        </xsl:if>
      </xsl:otherwise>
    </xsl:choose>
  </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}">
      Подробнее
    </a>
  </xsl:template>
<udt:template listType="table" delimiter=";" listView="&lt;tr class=&quot;Normal&quot;&gt;&#xD;&#xA;  &lt;td&gt;[UDT:EditLink]&lt;/td&gt;&#xD;&#xA;  &lt;td class=&quot;news_sepsrstor&quot;&gt;[Title] [UDT:DetailView]&lt;/td&gt;&#xD;&#xA;  &lt;td class=&quot;news_sepsrstor&quot;&gt;[Img]&lt;/td&gt;&#xD;&#xA;&lt;/tr&gt;" headerView="" detailView="&lt;table&gt;&#xD;&#xA;  &lt;tr&gt;&#xD;&#xA;    &lt;td class=&quot;Normal&quot;&gt;[Body] [UDT:ListView]&lt;/td&gt;&#xD;&#xA;  &lt;/tr&gt;&#xD;&#xA;&lt;/table&gt;" trackingEmail="" showDetailView="true" />
</xsl:stylesheet>