Prasad Bolla's SharePoint Blog

Click Here to go through the Interesting posts within my Blog.

Click Here to go through the new posts in my blog.

Monday, December 05, 2011

Getting Current Page Url using xslt.

<%@ Page language="C#" inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" masterpagefile="~masterurl/default.master" meta:progid="SharePoint.WebPartPage.Document" %>
<%@ Register tagprefix="WebPartPages" namespace="Microsoft.SharePoint.WebPartPages" assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register tagprefix="SharePoint" namespace="Microsoft.SharePoint.WebControls" assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<asp:Content id="Content1" runat="Server" contentplaceholderid="PlaceHolderMain">
<script language="javascript" type="text/javascript">
function getLinkDynamic()
{
 var strUrl="/{@FileRef}/DispForm.aspx?ID={@ID}&Source=window.location.href";
 return strUrl
}
</script>
    <WebPartPages:SPProxyWebPartManager runat="server" id="ProxyWebPartManager">
    </WebPartPages:SPProxyWebPartManager>
    <table style="width: 100%">
        <tr>
            <td>
            <WebPartPages:WebPartZone id="g_946A9FBBB7644CEFB36BBE70340D9A15" runat="server" title="Zone 1"><ZoneTemplate>
            <WebPartPages:DataFormWebPart runat="server" SuppressWebPartChrome="False" Description="" PartImageSmall="" DataSourceID="" MissingAssembly="Cannot import this Web Part." ListName="{53175A92-E6CC-4464-8E5C-9C23436D0577}" FrameType="None" ConnectionID="00000000-0000-0000-0000-000000000000" DetailLink="" ExportControlledProperties="True" IsVisible="True" AllowRemove="False" AllowEdit="False" ID="g_6b7417ff_0b73_40ae_84bc_152313e9a2cd" Dir="Default" FrameState="Normal" DisplayName="Test" ViewContentTypeId="" AllowClose="False" AllowConnect="False" PageSize="-1" Default="FALSE" AllowMinimize="False" IsIncludedFilter="" ShowWithSampleData="False" ChromeType="None" HelpMode="Modeless" ExportMode="All" ViewFlag="0" Title="Test" HelpLink="" AllowHide="False" AllowZoneChange="False" PartOrder="1" UseSQLDataSourcePaging="True" PartImageLarge="" IsIncluded="True" NoDefaultStyle="TRUE" __MarkupType="vsattributemarkup" __WebPartId="{F3F8B212-E809-47FE-952C-E01E98F22F81}" __AllowXSLTEditing="true" WebPart="true" Height="" Width=""><DataSources>
<SharePoint:SPDataSource runat="server" DataSourceMode="List" SelectCommand="&lt;View&gt;&lt;/View&gt;" UseInternalName="True" ID="Test1"><SelectParameters><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{53175A92-E6CC-4464-8E5C-9C23436D0577}" Name="ListID"></WebPartPages:DataFormParameter>
</SelectParameters><UpdateParameters><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{53175A92-E6CC-4464-8E5C-9C23436D0577}" Name="ListID"></WebPartPages:DataFormParameter>
</UpdateParameters><InsertParameters><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{53175A92-E6CC-4464-8E5C-9C23436D0577}" Name="ListID"></WebPartPages:DataFormParameter>
</InsertParameters><DeleteParameters><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{53175A92-E6CC-4464-8E5C-9C23436D0577}" Name="ListID"></WebPartPages:DataFormParameter>
</DeleteParameters>
</SharePoint:SPDataSource>
</DataSources>
<ParameterBindings>
             <ParameterBinding Name="ListID" Location="None" DefaultValue="{53175A92-E6CC-4464-8E5C-9C23436D0577}"/>
             <ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>
             <ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
             <ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>
             <ParameterBinding Name="url_PATH_INFO" Location="ServerVariable(PATH_INFO)" DefaultValue=""/>
             <ParameterBinding Name="url_HTTP_HOST" Location="ServerVariable(HTTP_HOST)" DefaultValue=""/>
            </ParameterBindings>
<DataFields>@Title,Title;@Description,Description;@ID,ID;@ContentType,Content Type;@Modified,Modified;@Created,Created;@Author,Created By;@Editor,Modified By;@_UIVersionString,Version;@Attachments,Attachments;@File_x0020_Type,File Type;@FileLeafRef,Name (for use in forms);@FileDirRef,Path;@FSObjType,Item Type;@_HasCopyDestinations,Has Copy Destinations;@_CopySource,Copy Source;@ContentTypeId,Content Type ID;@_ModerationStatus,Approval Status;@_UIVersion,UI Version;@Created_x0020_Date,Created;@FileRef,URL Path;</DataFields>
<Xsl>
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
<xsl:param name="url_PATH_INFO" />
<xsl:param name="url_HTTP_HOST" />
<xsl:variable name="CurrentPageUrl" select="concat('http://',$url_HTTP_HOST,$url_PATH_INFO)" />
 <xsl:output method="html" indent="no"/>
 <xsl:decimal-format NaN=""/>
 <xsl:param name="dvt_apos">'</xsl:param>
 <xsl:variable name="dvt_1_automode">0</xsl:variable>
 <xsl:template match="/">
  <xsl:call-template name="dvt_1"/>
 </xsl:template>
 <xsl:template name="dvt_1">
  <xsl:variable name="dvt_StyleName">Table</xsl:variable>
  <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
  <table border="0" width="100%" cellpadding="2" cellspacing="0">
   <tr valign="top">
    <xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
     <th class="ms-vh" width="1%" nowrap="nowrap"></th>
    </xsl:if>
    <th class="ms-vh" nowrap="nowrap">Title</th>
    <th class="ms-vh" nowrap="nowrap">Description</th>
   </tr>
   <xsl:call-template name="dvt_1.body">
    <xsl:with-param name="Rows" select="$Rows"/>
   </xsl:call-template>
  </table>
 </xsl:template>
 <xsl:template name="dvt_1.body">
  <xsl:param name="Rows"/>
  <xsl:for-each select="$Rows">
   <xsl:call-template name="dvt_1.rowview"/>
  </xsl:for-each>
 </xsl:template>
 <xsl:template name="dvt_1.rowview">
  <tr>
   <xsl:if test="position() mod 2 = 1">
    <xsl:attribute name="class">ms-alternating</xsl:attribute>
   </xsl:if>
   <xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
    <td class="ms-vb" width="1%" nowrap="nowrap">
     <span ddwrt:amkeyfield="ID" ddwrt:amkeyvalue="ddwrt:EscapeDelims(string(@ID))" ddwrt:ammode="view"></span>
    </td>
   </xsl:if>
   <td class="ms-vb">
    <a href="/{@FileDirRef}/DispForm.aspx?ID={@ID}&amp;Source={$CurrentPageUrl}" target="_blank"><xsl:value-of select="@Title" /></a></td>
   <td class="ms-vb">
    <xsl:value-of select="@Description"/>
   </td>
  </tr>
 </xsl:template>
</xsl:stylesheet> </Xsl>
</WebPartPages:DataFormWebPart>
</ZoneTemplate></WebPartPages:WebPartZone></td>
        </tr>
    </table>
</asp:Content>

No comments:

Post a Comment