XML Viewer WebPart可以将数据源为xml的内容显示到页面中,本文简单说明

1.新建一个页面用于测试使用,在Site Action下的New Page:

SharePoint2010 XML Viewer Web Part

 

2.在Insert tab插入WebPart,选择Content Rollup类别下的XML Viewer:

SharePoint2010 XML Viewer Web Part

 

3.XML Viewer添加到页面后点击open the tool pane:

SharePoint2010 XML Viewer Web Part

 

4.在属性面板中将我们准备好的XML和XSL文件内容输入进去:

SharePoint2010 XML Viewer Web Part

Xml文件内容如下:

<?xml version="1.0" encoding="utf-8" ?>

<?xml-stylesheet type="text/xsl" href="Employees.xsl"?>

<Employees>

<Employee>

<EmployeeID>1</EmployeeID>

<EmployeeDes type="choice">Cary,your post?</EmployeeDes>

<posts>

<post>SSE</post>

<post>SA</post>

<post>PM</post>

</posts>

</Employee>

<Employee>

<EmployeeID>2</EmployeeID>

<EmployeeDes type="choice">James,your post?</EmployeeDes>

<posts>

<post>SSE</post>

<post>SA</post>

<post>PM</post>

</posts>

</Employee>

</Employees>

Xsl文件内容如下:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

<html>

<body>

<h1>Employee Post Form</h1>

<ol>

<xsl:for-each select="//Employee">

<li>

<strong>

<xsl:value-of select="EmployeeDes"/>

</strong>

<br/>

<xsl:for-each select="posts/post">

<span style="font-style: italic;">

<input type="radio">

<xsl:attribute name="name">

<xsl:value-of select="http://www.cnblogs.com/EmployeeID"/>

</xsl:attribute>

<xsl:value-of select="."/>

</input>

</span>

<br/>

</xsl:for-each>

</li>

<br/>

</xsl:for-each>

</ol>

</body>

</html>

</xsl:template>

</xsl:stylesheet>

 

5.确定后显示如下:

SharePoint2010 XML Viewer Web Part

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2022-02-22
  • 2021-06-12
  • 2021-07-09
  • 2021-08-18
猜你喜欢
  • 2022-02-12
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2022-01-19
相关资源
相似解决方案