<xsl:value-of select 语句 排序=”name”/>语句的作用是

如何调试SharePoint中XsltListViewWebPart的XSL - 推酷
如何调试SharePoint中XsltListViewWebPart的XSL
&一、概述:
SharePoint中的XsltListViewWebPart使用XSLT+XML实现页面的显示,我们在实际开发中,如果对XSLT的修改很熟悉,则可以减轻很大的开发工作量。
而XsltListViewWebPart只能在SharePoint Designer中修改,不方便调试。
以下阐述,如何将XML和XSLT扣出来,在Stylus Studio 2010中调试。
环境及工具:
SharePoint 2010
SharePoint Designer 2010
Stylus Studio 2010
二、步骤:
SharePoint Designer 2010
打开站点,在网站页面中新建“
修改页面名称
右键选择该页面,在菜单中选择“高级模式下编辑”项。在“插入”菜单下,选择“数据视图”
选择我们已经有的任意
,即可插入
XsltListViewWebPart
选中刚刚插入的
,在菜单上选择“设计”,选择“自定义
”,选择“自定义整个视图”
无法保存解决方案
我们经常会遇到修改了XSL后,浏览时并未生效,而且下次打开页面后,发现上次的修改都丢失了。可以搜索到ddwrt:ghost=&hide& 属性,并全部删除即可
如何获取WEBPART的XML,在下图位置中加入如下代码
&xsl:output version=&1.0& indent=&yes& encoding=&UTF-8& method=&xml& /&
&xsl:template match=&/&&
&xsl:copy-of select=&*&/&
&/xsl:template&
保存,浏览
选择文本,复制出如下
&dsQueryResponse ViewStyleID=&& BaseViewID=&1& TemplateType=&100& RowLimit=&30&&
&Row ID=&415& PermMask=&0x7fffffffffffffff& Attachments=&0& Title=&& FileLeafRef=&415_.000& FileLeafRef.Name=&415_& FileLeafRef.Suffix=&000& FSObjType=&0& Created_x0020_Date=&1;# 21:07:18& Created_x0020_Date.ifnew=&1& FileRef=&/PWA/Lists/PersonWeeklyProject/415_.000& FileRef.urlencode=&%2FPWA%2FLists%2FPersonWeeklyProject%2F415%5F%2E000& FileRef.urlencodeasurl=&/PWA/Lists/PersonWeeklyProject/415_.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=&0xBCAD7C5B60A272E6B3& ProjectName=&Project_01& WorkTime=&20& WorkTime.=&20.0& MainWork=&& ProjectId=&794ddca5-d1b6-4eac-8cfc-28fb9ddd4fd0& PersonReportId=&3ceee52d-db45-d5abf4f223& ResourceId=&& OverTime=&0.0& OverTime.=&0& Approve=&msoutsourcing\wwang& IsApproved=&0& IsApproved.=&0& IsReportApproved=&0& IsReportApproved.=&0& test=&&a href=&http://ws-bjgisgtfs-04:82/PWA/_layouts/WrkStat.aspx?List=872f5ee3--83c8-4f12c7a3c8e0&WorkflowInstanceID=%7b0FdA%2d56A82B007%7d&&&span dir=none value=2&进行中&/span&&/a&& /&
&Row ID=&416& PermMask=&0x7fffffffffffffff& Attachments=&0& Title=&& FileLeafRef=&416_.000& FileLeafRef.Name=&416_& FileLeafRef.Suffix=&000& FSObjType=&0& Created_x0020_Date=&1;# 21:07:18& Created_x0020_Date.ifnew=&1& FileRef=&/PWA/Lists/PersonWeeklyProject/416_.000& FileRef.urlencode=&%2FPWA%2FLists%2FPersonWeeklyProject%2F416%5F%2E000& FileRef.urlencodeasurl=&/PWA/Lists/PersonWeeklyProject/416_.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=&0xBCAD7C5B60A272E6B3& ProjectName=&vdi& WorkTime=&20& WorkTime.=&20.0& MainWork=&& ProjectId=&8a09e86d-b072-45f6-a720-fb1f3dd4777f& PersonReportId=&3ceee52d-db45-d5abf4f223& ResourceId=&& OverTime=&0.0& OverTime.=&0& Approve=&msoutsourcing\wwang& IsApproved=&0& IsApproved.=&0& IsReportApproved=&0& IsReportApproved.=&0& test=&&a href=&http://ws-bjgisgtfs-04:82/PWA/_layouts/WrkStat.aspx?List=872f5ee3--83c8-4f12c7a3c8e0&WorkflowInstanceID=%7b5EdC2BB%2d4BB7%2d833E%2d4FF26A8F45B3%7d&&&span dir=none value=2&进行中&/span&&/a&& /&
&/dsQueryResponse&
Stylus Studio 2010
将刚刚复制出来的
,粘贴到下面
默认样式表
编写相关的
到错误,并修改
修改后,再进行调试
能够成功运行,相关的
&?xml version=&1.0&?&
&xsl:stylesheet version=&1.0& xmlns:xsl=&http://www.w3.org/1999/XSL/Transform&&
&xsl:template match=&/&&
&style&.first
&td&Approve&/td&
&td&ProjectName&/td&
&xsl:apply-templates select=&dsQueryResponse/Rows/Row&&&/xsl:apply-templates&
&/xsl:template&
&xsl:template match=&Row&&
&xsl:choose&
&xsl:when test=&@OverTime & 0&&
&xsl:attribute name=&class&&first&/xsl:attribute&
&xsl:value-of select=&@Approve&&&/xsl:value-of&
&/xsl:when&
&xsl:when test=&@Approve = 1&&
&xsl:attribute name=&class&&second&/xsl:attribute&
&a target=&_blank&&
&xsl:attribute name=&href&&
&xsl:value-of select=&@FileRef.urlencodeasurl&&&/xsl:value-of&
&/xsl:attribute&
&xsl:value-of select=&@Approve&&&/xsl:value-of&
&/xsl:when&
&xsl:otherwise&
&xsl:value-of select=&@Approve&&&/xsl:value-of&
&/xsl:otherwise&
&/xsl:choose&
&xsl:value-of select=&@ProjectName&&&/xsl:value-of&
&/xsl:template&
&/xsl:stylesheet&
在左下脚可以看到预览(浏览器)
生成的文本预览
文本中加入如下代码,如下图所示
&?xml-stylesheet type=&text/xsl& href=&data.xsl&?&
在浏览器中打开
,可以浏览效果
调试好效果后,可以把做好的
SharePoint Designer
中达到想要的效果
三、效果演示:
如下是使用配置出来的页面效果,上面的搜索框是用INFOPATH制作的
中间和下面的框是用WEBPART实现的
鼠标经过指定位置后,会异步加载数据,并弹出DIV框
已发表评论数()
&&登&&&陆&&
已收藏到推刊!
请填写推刊名
描述不能大于100个字符!
权限设置: 公开
仅自己可见怎么将日期右对齐_百度知道
提问者采纳
给DIV加一个alight=right属性就行吧
其他类似问题
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁XLST学习笔记 - 带眼镜的鱼 - 博客园
一、样式表声明及引用:
&xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&
&xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&
在XML文件里面写出样式表的路径和文件名
&?xml-stylesheet type="text/xsl" href="fileName.xsl"?&
<span style="color: #.&xsl:template math="/"&&/xsl:template&
元素定义了一个模板。而 math="/" 属性则把此模板与 XML 源文档的根相联系。
<span style="color: #.&xsl:value-of select="[XPath expression]" /&
提取某个选定节点的值,并把值添加到转换的输出流中。[XPath expression]表示提取节点的XPath路径
<span style="color: #.&xsl:for-each select="[XPath expression]"&&/xsl:for-each&
用于选取指定的节点集中的每个 XML 元素
注:select可以使用设置过滤条件来进行查询:
& 大于&& 小于=&&&& 等于!=&&& 不等于
例如:&xsl:for-each select="catalog/cd[Price & 10]"&...&/xsl:for-each&
还可以使用XPath的模糊查询:
&xsl:for-each select="catalog/cd[contains(author='Bob.Dylan')]"&...&/xsl:for-each&
如果是属性内容,则用这样的表达式:
&xsl:for-each select="catalog/cd[contains(@author='Bob.Dylan')]"&...&/xsl:for-each&
3.1 &xsl:sort select="[XPath expression]" /&
排序。对结果进行排序,只要简单地在 XSL 文件中的 &xsl:for-each& 元素内部添加一个 &xsl:sort& 元素就可以了。
3.2 &xsl:if test="expression"&&/xsl:if&
在&xsl:for-each&内部添加,实现判断功能,test为条件表达式:
&xsl:for-each select="catalog/cd"&
  &xsl:if test="price & 20"&...&/xsl:if&
&/xsl:for-each&
<span style="color: #.3 &xsl:choose&
包含在foreach循环中,多重条件判断语句。
格式如下:
&xsl:for-each select="catalog/cd"&
  &xsl:choose&
    &xsl:when test="expression1"&
      .....
    &/xsl:when&
    &xsl:when test="expression2"&
      .....
    &/xsl:when&
    &xsl:otherwise&
      .....
    &/xsl:otherwise&
  &&/choose&
&/xsl:for-each&
<span style="color: #.&xsl:apply-templates /&
可把一个模板应用于当前的元素或者当前元素的子节点.
&h2&My Cd List&/h2&
&xsl:apply-templates /&
&xsl:template match="cd"&&p&&xsl:apply-templates select="title"/& &xsl:apply-templates select="artist"/&&/p&&/xsl:template&&xsl:template match="title"&Title: &span style="color:#ff0000"&&xsl:value-of select="."/&&/span&&br /&&/xsl:template&&xsl:template match="artist"&Artist: &span style="color:#00ff00"&&xsl:value-of select="."/&&/span&&br /&&/xsl:template&当前位置: >
> xsl position()函数 lt and gt 有关问题
xsl position()函数 lt and gt 有关问题
weitingmei662605 & at
xsl position()函数 lt and gt 问题我的sitemap.xml如下:& &node& &title&Home &/title& &link& &a href=&/CMS400Developer/default.aspx& alt=&Medical Home&&Home &/a& &/link& &description&Medical Home &/description& &node& &title&About Us &/title& &link& &a href=&/CMS400Developer/aboutus.aspx& alt=&About Medical&&About Us &/a& &/link& &description&About Medical &/description& &node& &title&Staff &/title& &link& &a href=&/CMS400Developer/staff.aspx& alt=&Staff list&&Staff &/a& &/link& &description&Staff list &/description& &/node& &node& &title&News &/title& &link& &a href=&/CMS400Developer/news.aspx& alt=&News&&News &/a& &/link& &description&News &/description& &/node& &node& &title&Careers &/title& &link& &a href=&/CMS400Developer/jobs.aspx& alt=&Careers at Medical Center&&Careers &/a& &/link& &description&Careers at Medical Center &/description& &/node& &node& &title&Calender &/title& &link& &a href=&/CMS400Developer/events.aspx& alt=&&&Calender &/a& &/link& &description& &/description& &/node& &/node& &node& &title&Services &/title& &link& &a href=&/CMS400Developer/services.aspx& alt=&Services&&Services &/a& &/link& &description&Services &/description& &/node& &node& &title&Products &/title& &link& &a href=&& alt=&Product page&&Products &/a& &/link& &description&Product page &/description& &/node& &/node$>$ 现在的xsl文件如下。如果写成]&xsl:if test=&position() & $folderCount+2&&,可以打印出子目录,没有任何问题。只是当我将lt 改成 gt 后,就只能打出主目录,其对应的子目录就输出不了了。不知道这是什么原因造成的,请各位帮忙!多谢!& xml version=&1.0& encoding=&UTF-8& &&xsl:stylesheet version=&1.0& xmlns:xsl=&;& & &xsl:variable name=&folderCount& select=&round( count(/node/node) div 2)&/& & &xsl:template match=&/node&& &
&div id=&columnOne&& &
This is the first column &
&div id=&columnTwo&& &
&ul class=&sitemap&& &
&li id=&firstItem& class=&primary&& &
&xsl:attribute name=&href&& &
&xsl:value-of select=&link/a/@href&/& &
&/xsl:attribute& &
&xsl:value-of select=&title&/& &
&xsl:apply-templates select=&node&$>$/xsl:apply-templates& &
& &/xsl:template& & &xsl:template match=&node&& &
&xsl:if test=&position() & $folderCount+2&& &
&li class=&primary&& &
&xsl:choose& &
&xsl:when test=&link/a&& &
&xsl:choose& &
&xsl:when test=&link/a[@href!='']&& &
&xsl:attribute name=&href&& &
&xsl:value-of select=&link/a/@href&/& &
&/xsl:attribute& &
&xsl:value-of select=&title&/&
本问题标题:
本问题地址:
温馨提示:本问题已经关闭,不能解答。
暂无合适的专家
&&&&&&&&&&&&&&&
希赛网 版权所有 & &&&&增值电信业务经营许可证湘B2-我的邮箱是wxb_nudt&#。
我的Blog中发表的文章,如无说明,都是原创,如果要引用,请注明出处。
留言簿(47)
随笔分类(53)
随笔档案(53)
文章分类(2)
文章档案(2)
MDA技术相关网站
友情Blog链接
我老婆的博客,记录了女儿的成长!
阅读排行榜
评论排行榜}

我要回帖

更多关于 select 语句 排序 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信