环境:sp designer2013+visual2013
1.在spdesigner中添加web部件页,插入数据视图,选择<webpart:xmllistview>设计,转为xslt定义整个视图。
2.查找ddwrt:ghost="hide"换为空。
3.在<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:pcm="urn:PageContentManager" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office" ddwrt:ghost="show_all"> <xsl:include href="/_layouts/15/xsl/main.xsl"/> <xsl:include href="/_layouts/15/xsl/internal.xsl"/> <xsl:param name="AllRows" select="/dsQueryResponse/Rows/Row[$EntityName = '' or (position() >= $FirstRow and position() <= $LastRow)]"/> <xsl:param name="dvt_apos">'</xsl:param>
后面加入 <xsl:output version="1.0" indent="yes" encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<xmp>
<xsl:copy-of select="*"/>
</xmp>
</xsl:template> 4.浏览后得到
<dsQueryResponse ViewStyleID="" BaseViewID="1" TemplateType="100" RowLimit="30"> <Rows> <Row ID="2" PermMask="0x1000030061" FSObjType="0" Title="ee" FileLeafRef="2_.000" FileLeafRef.Name="2_" FileLeafRef.Suffix="000" Created_x0020_Date="1;#2014-04-24 10:29:14" Created_x0020_Date.ifnew="1" FileRef="/Lists/catchus/2_.000" FileRef.urlencode="%2FLists%2Fcatchus%2F2%5F%2E000" FileRef.urlencodeasurl="/Lists/catchus/2_.000" File_x0020_Type="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapall="icgen.gif|||" HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapico="icgen.gif" ContentTypeId="0x0100F36755CAB26DFA42AC754CFBC15867D3" _x59d3_="ee" _x540d_="eee" _x804c__x4f4d_="ee" _x7535__x5b50__x90ae__x4ef6_="ee" _x8054__x7cfb__x7535__x8bdd_="eee" _x5168__x540d_="eeee" />
<Row ID="3" PermMask="0x1000030061" FSObjType="0" Title="ff" FileLeafRef="3_.000" FileLeafRef.Name="3_" FileLeafRef.Suffix="000" Created_x0020_Date="1;#2014-04-24 10:34:21" Created_x0020_Date.ifnew="1" FileRef="/Lists/catchus/3_.000" FileRef.urlencode="%2FLists%2Fcatchus%2F3%5F%2E000" FileRef.urlencodeasurl="/Lists/catchus/3_.000" File_x0020_Type="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapall="icgen.gif|||" HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapico="icgen.gif" ContentTypeId="0x0100F36755CAB26DFA42AC754CFBC15867D3" _x59d3_="ff" _x540d_="fff" _x804c__x4f4d_="ff" _x7535__x5b50__x90ae__x4ef6_="fff" _x8054__x7cfb__x7535__x8bdd_="ff" _x5168__x540d_="fff" /> </Rows> </dsQueryResponse>
将此代码另存为a.xml文件
5.打开v2013,创建a.xslt文档
添加源文当a.xml.编辑a.xslt如下
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" > <xsl:output method="html" indent="yes"/>
<xsl:template match="/"> <html> <head> <style> .first{color:red;} .second{color:blue;} </style> </head> <body> <table> <tr> <td>t1</td> <td>t2</td> <td>t3</td> <td>t4</td> <td>t5</td> <td>t6</td> <td>t7</td> </tr> <xsl:apply-templates select="dsQueryResponse/Rows/Row"></xsl:apply-templates> </table> </body> </html> </xsl:template> <xsl:template match="Row"> <tr> <td> <xsl:value-of select="@Title"/> </td> <td> <xsl:value-of select="@_x59d3_"/> </td> <td> <xsl:value-of select="@_x540d_"/> </td> <td> <xsl:value-of select="@_x804c__x4f4d_"/> </td> <td> <xsl:value-of select="@_x7535__x5b50__x90ae__x4ef6_"/> </td> <td> <xsl:value-of select="@_x8054__x7cfb__x7535__x8bdd_"/> </td> <td> <xsl:value-of select="@_x5168__x540d_"/> </td> </tr> </xsl:template> </xsl:stylesheet>
以此方法来调试自定义表格。
把做好的template 复制到spdesigner中。 (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|