CSDN博客

img moeryang

用xsl格式xml的例子

发表于2005/1/2 13:56:00  1824人阅读

<!---

<?xml version="1.0" encoding="gb2312"?>
<?xml-stylesheet href="test.xsl" type="text/xsl"?>
 <addressbook>
    <contact>
           <name firstname="yang">姓名:</name>
          <address>原村</address>
           <city>广州</city>
           <state>广东</state>
           <zip>510020</zip>
   </contact>
 </addressbook>

<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
  <!-- 模板匹配根接点开始 --->
<!--
<xsl:template match="/">
<html>
<head>
             <title>fdfd</title>
</head>
<body>
             <table border="1" >
                <tr>
                   <!-- 循环匹配接点值-->
                   <!---
                   <xsl:for-each select="addressbook/contact">
                  <td>
                       <xsl:value-of select="name"/>
                  </td>
                </xsl:for-each>
                <td>
                    
                     <xsl:for-each select="addressbook/contact/name">
                    <!--此出显示属性值 -->
                    <!--
                    <xsl:value-of select="@firstname"/>
                     </xsl:for-each>
               </td>
          </tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
--->

0 0

相关博文

我的热门文章

img
取 消
img