你要的XSL文件﹕<?xml version="1.0" encoding="UTF-8"?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/xhtml1/strict">
<body style="font-family:Arial,helvetica,sans-serif;font-size:12pt; background-color:#EEEEEE"><xsl:for-each select="document">
<span><xsl:value-of select="left"/></span>
<span><xsl:value-of select="with"/></span>
</xsl:for-each><xsl:for-each select="document/element/button">
<div style="background-color:teal;color:white;padding:4px">
<span style="font-weight:bold;color:white">
<xsl:value-of select="name" />
</span>
<xsl:value-of select="text" />
</div>
<div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
<xsl:value-of select="top" />
<span style="font-style:italic">
(
<xsl:value-of select="left" />
calories per serving)
</span>
</div>
</xsl:for-each>
</body>
</html>你的XML加入你的XSL﹕
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="6.xsl"?>
<document>
<width>300</width>
<height>300</height>
<title>表单</title>
<element>
<button>
<left>90</left>
<top>66</top>
<width>119</width>
<height>37</height>
<name>htmlbutton1</name>
<text>测试</text>
</button>
</element>
<width>300</width>
<height>300</height>
<title>表单</title>
<element>
<button>
<left>90</left>
<top>66</top>
<width>119</width>
<height>37</height>
<name>htmlbutton1</name>
<text>测67试</text>
</button>
</element>
</document>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/xhtml1/strict">
<body style="font-family:Arial,helvetica,sans-serif;font-size:12pt; background-color:#EEEEEE"><xsl:for-each select="document">
<span><xsl:value-of select="left"/></span>
<span><xsl:value-of select="with"/></span>
</xsl:for-each><xsl:for-each select="document/element/button">
<div style="background-color:teal;color:white;padding:4px">
<span style="font-weight:bold;color:white">
<xsl:value-of select="name" />
</span>
<xsl:value-of select="text" />
</div>
<div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
<xsl:value-of select="top" />
<span style="font-style:italic">
(
<xsl:value-of select="left" />
calories per serving)
</span>
</div>
</xsl:for-each>
</body>
</html>你的XML加入你的XSL﹕
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="6.xsl"?>
<document>
<width>300</width>
<height>300</height>
<title>表单</title>
<element>
<button>
<left>90</left>
<top>66</top>
<width>119</width>
<height>37</height>
<name>htmlbutton1</name>
<text>测试</text>
</button>
</element>
<width>300</width>
<height>300</height>
<title>表单</title>
<element>
<button>
<left>90</left>
<top>66</top>
<width>119</width>
<height>37</height>
<name>htmlbutton1</name>
<text>测67试</text>
</button>
</element>
</document>
解决方案 »
- winform窗体里嵌入word,怎么将word 2007左上角office按钮屏蔽?
- 非常经典的A+B problem如何读取两个数?
- 高分求解中!!C#窗体设计中UserControl设计使用问题!!!!!!!!!!
- 分享:C# 连连看源代码(丰富音乐及图片)转自51CTO
- 怎样直接在WinForm嵌入media player吗?
- WinForm下的DataGrid的合计行怎么加?
- 请问silverlight使用mvvm light如何绑定一个Behavior中的事件
- 这个代码,哪里错了?
- 送分题.....请问:以pdg为扩展名的文件用什么打开?
- 怎么样判断该进程已经终止?
- 如何使用as关键字
- WebRequest 获取后面页面源代码问题
<html>
<body>
<xml id="cdcat" src="ted.xml"></xml>
<table border="1" datasrc="#cdcat">
<tr>
<td><span datafld="left"></span></td>
<td><span datafld="top"></span></td>
<td><span datafld="width"></span></td>
</tr>
</table>
</body>
</html> td.xml文件內容﹕
<?xml version="1.0" encoding="UTF-8"?>
<document>
<button>
<left>90</left>
<top>66</top>
<width>119</width>
<height>37</height>
<name>htmlbutton1</name>
<text>测试</text>
</button>
</document>
---------------------------------
但是如果你的XML是你的那樣即里面有兩層子節點的我測試不成功﹗