Querystring参数在xml viewer Web部件中不起作用

时间:2017-05-29 18:39:45

标签: asp.net xml xslt sharepoint-2010

有一个带有XML Web部件的SharePoint网页(pocwebpage.aspx),并且Web部件上链接了XSLT和XML。 Querystring参数尝试在XMLWeb Part页面上传递URL,但在加载期间不通过XSLT传递。以下是您要查看的数据

XML

<RootData>
<Employee>
 <Name>Ramesh</Name>
</Employee>
<Employee>
 <Name>Suresh</Name>
</Employee>
<Employee>
 <Name>Ganesh</Name>
</Employee>
</RootData>

XSLT

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:param name="param"/>
<xsl:template match="Employee">
Parameter : <xsl:value-of select="$param"/>
 <xsl:for-each select="RootData/Employee">
    Employee Name : <xsl:value-of select="Name"/>
 </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

$ param仅返回空字符串,而不返回查询参数值“discovery”

查询字符串URL

http://sharepoint-server/sitename/pocwebpage.aspx?param=discovery

XML Webpart

非常感谢您的帮助,感谢您的帮助。

2 个答案:

答案 0 :(得分:1)

定义参数时,不需要button1.setOnAction(event -> { setMedia("file1.mp3"); }); button2.setOnAction(event -> { setMedia("file2.mp3"); });

$

访问此参数时,您需要<xsl:param name="param"/>

$

答案 1 :(得分:1)

不幸的是,您不能使用XSL执行此操作 - 它在服务器端呈现,而不提供有关查询URL的任何数据。

解决方法是通过JavaScript获取查询参数。

相关问题