当前位置:编程学习 > C#/ASP.NET >>

急!关于XML转换和WebService调用的问题

下面是一个描述“Button”的XML文件:

(1) 请问如何能够将这个XML文件转换为标准的HTML文件?如何编写转换需要的XLST?
(2) 对于一个标准HTML编写的文本框,如在文本框中填写数据,如何将数据提交回服务器,可用WebService?

求以上两个问题的详细解决方法,代码最好。因为以前没有接触过这些,感觉特别头痛。分数不够再补。谢谢!!

<?xml version="1.0" encoding="GB2312"?>
<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>
</document> --------------------编程问答-------------------- ding --------------------编程问答-------------------- 帮顶 --------------------编程问答-------------------- ding --------------------编程问答-------------------- 先頂 --------------------编程问答-------------------- 你要的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中格式化xml
<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是你的那樣即里面有兩層子節點的我測試不成功﹗
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,