Parameter Binding(XSLT)

来源:互联网 发布:php的正则表达式 编辑:程序博客网 时间:2024/06/03 23:48

<WebPartPages:DataFormWebPart runat="server" SuppressWebPartChrome="False" Description="" PartImageSmall="" DataSourceID="" MissingAssembly="Cannot import this Web Part." ListName="{B6F8B9BF-680B-4D6B-9CD6-1040311DFFA4}" FrameType="Default" ConnectionID="00000000-0000-0000-0000-000000000000" DetailLink="" ExportControlledProperties="True" IsVisible="True" AllowRemove="True" AllowEdit="True" ID="g_36cc8185_140f_4af3_8191_08be92144955" Dir="Default" FrameState="Normal" DisplayName="dfdf" ViewContentTypeId="" AllowConnect="True" PageSize="-1" Default="FALSE" AllowMinimize="True" IsIncludedFilter="" ShowWithSampleData="False" HelpMode="Modeless" ExportMode="All" ViewFlag="0" Title="dfdf" HelpLink="" AllowHide="True" AllowZoneChange="True" PartOrder="1" UseSQLDataSourcePaging="True" PartImageLarge="" IsIncluded="True" NoDefaultStyle="TRUE" __MarkupType="vsattributemarkup" __WebPartId="{36CC8185-140F-4AF3-8191-08BE92144955}" __AllowXSLTEditing="true" WebPart="true" Height="" Width=""><DataSources>
<SharePointWebControls:SPDataSource runat="server" DataSourceMode="List" SelectCommand="&lt;View&gt;&lt;/View&gt;" UseInternalName="True" ID="dfdf1"><SelectParameters><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{B6F8B9BF-680B-4D6B-9CD6-1040311DFFA4}" Name="ListID"></WebPartPages:DataFormParameter>
</SelectParameters><UpdateParameters><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{B6F8B9BF-680B-4D6B-9CD6-1040311DFFA4}" Name="ListID"></WebPartPages:DataFormParameter>
</UpdateParameters><InsertParameters><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{B6F8B9BF-680B-4D6B-9CD6-1040311DFFA4}" Name="ListID"></WebPartPages:DataFormParameter>
</InsertParameters><DeleteParameters><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{B6F8B9BF-680B-4D6B-9CD6-1040311DFFA4}" Name="ListID"></WebPartPages:DataFormParameter>
</DeleteParameters>
</SharePointWebControls:SPDataSource>
</DataSources>
<ParameterBindings>
         <ParameterBinding Name="ListID" Location="None" DefaultValue="{B6F8B9BF-680B-4D6B-9CD6-1040311DFFA4}"/>
         <ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>
         <ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
         <ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>
         <ParameterBinding Name="Url" Location="ServerVariable(URL)" DefaultValue=""/>
         <ParameterBinding Name="Imgurl" Location="Resource(wss,Yes)" DefaultValue=""/>
        </ParameterBindings>
<DataFields>@ID,ID;@ContentType,Content Type;@Title,Title;@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 user" 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" xmlns:user="urn:custom-javascript"><xsl:output method="xml" version="1.0" omit-xml-declaration="yes" indent="yes" encoding="utf-8"/><xsl:decimal-format NaN=""/>
 <xsl:param name="dvt_apos">&apos;</xsl:param>
 <xsl:param name="Url"></xsl:param>
 <xsl:param name="Imgurl"></xsl:param>
 <xsl:variable name="dvt_1_automode">0</xsl:variable>
 <xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls">
  <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="">Title</th>
    <th class="ms-vh" nowrap="">Modified By</th>
    <th class="ms-vh" nowrap="">Modified</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">
    <xsl:value-of select="@Title"/>
    <xsl:choose>
          <xsl:when test="substring($Url,2,5)='en-US'">
            <img src="
http://prcsgi07933:41305/Style%20Library/Images/en-us/en.JPG"/></xsl:when>
          <xsl:otherwise>
           <img src="
http://prcsgi07933:41305/Style%20Library/Images/zh-cn/en.JPG"/></xsl:otherwise>
        </xsl:choose>

equal:

<img alt="" border   ="0">  
      <xsl:attribute   name="src">
    ../../Style Library/Images/<xsl:value-of select="substring-before(substring-after($Url,'/'),'/')"/>/en.JPG</xsl:attribute>
  </img>


    <xsl:value-of select="$Imgurl"/>
    <xsl:value-of select="user:SayHello()"/>

   </td>
   <td class="ms-vb">
    <xsl:value-of select="@Editor" disable-output-escaping="yes"/>
   </td>
   <td class="ms-vb">
    <xsl:value-of select="ddwrt:FormatDate(string(@Modified), 1033, 5)"/>
   </td>
  </tr>
 </xsl:template>
 <msxsl:script language="JavaScript" implements-prefix="user">
<![CDATA[
function SayHello() {
 
return "Hello World";
}
  ]]>

reference:

http://msdn.microsoft.com/en-us/library/ms524602(VS.85).aspx