以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 XML源码及示例(仅原创和转载) 』  (http://bbs.xml.org.cn/list.asp?boardid=32)
----  xml执行没有报错,显示有问题  (http://bbs.xml.org.cn/dispbbs.asp?boardid=32&rootid=&id=22150)


--  作者:jhrxrh
--  发布时间:9/12/2005 5:39:00 PM

--  xml执行没有报错,显示有问题
请教各位大虾,我编写了一个xml,xsl,点击在IE下执行没有报错,但显示的内容不对
代码如下:
bookmark.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="bookmark.xsl"?>
<book id="book oos" title="book mark">
   <chapter1 id="oos ch 1" title="user">
       <name>jhr</name>
    </chapter1>
    <chapter2 id="oos ch 2" title="http proxy">
       <par>
        <name>webproxy</name>
        <type>permanence</type>
       </par>
       <par>
         <name>secure proxy</name>
         <type>temporary</type>
       </par>
      </chapter2>
      <chapter3 id="oos ch 3" title="telnet ">
       <par>
        <name>telnet</name>
        <type>permanence</type>
       </par>
       <par>
         <name>ssh</name>
         <type>temporary</type>
       </par>
      </chapter3>
</book>
bookmark.xsl
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html"/>

  <xsl:template match="/book">
    <html><body>
      <xsl:apply-templates select="chapter1"/>
      <xsl:apply-templates select="chapter2"/>
      <xsl:apply-templates select="chapter3"/>
    </body></html>
  </xsl:template>

  <xsl:template match="chapter1">
 <TD>user:<xsl:value-of select="user"/></TD>
  </xsl:template>

  <xsl:template match="chapter2">
      <xsl:for-each select="chapter2/par">
         <TD>name : <xsl:value-of select="name"/></TD>
         <TD>type : <xsl:value-of select="type"/></TD>
      </xsl:for-each>
  </xsl:template>
  
  <xsl:template match="chapter3">
      <xsl:for-each select="chapter3/par">
         <p>
         <TD>name : <xsl:value-of select="name"/></TD>
         <TD>type : <xsl:value-of select="type"/></TD>
         </p>
      </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>


--  作者:Qr
--  发布时间:9/12/2005 7:38:00 PM

--  
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html"/>

  <xsl:template match="book">
    <html><body>
      <xsl:apply-templates select="chapter1"/>
      <xsl:apply-templates select="chapter2"/>
      <xsl:apply-templates select="chapter3"/>
    </body></html>
  </xsl:template>

  <xsl:template match="chapter1">
  <TD>user:<xsl:value-of select="name"/></TD>
  </xsl:template>

  <xsl:template match="chapter2">
      <xsl:for-each select="par">
         <TD>name : <xsl:value-of select="name"/></TD>
         <TD>type : <xsl:value-of select="type"/></TD>
      </xsl:for-each>
  </xsl:template>
  
  <xsl:template match="chapter3">
      <xsl:for-each select="par">
         <p>
         <TD>name : <xsl:value-of select="name"/></TD>
         <TD>type : <xsl:value-of select="type"/></TD>
         </p>
      </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>


--  作者:jhrxrh
--  发布时间:9/13/2005 10:33:00 AM

--  
ok,多谢!
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
42.969ms