以文本方式查看主题

-  W3CHINA.ORG讨论区 - 语义网·描述逻辑·本体·RDF·OWL  (http://bbs.xml.org.cn/index.asp)
--  『 XML基础 』  (http://bbs.xml.org.cn/list.asp?boardid=1)
----  [原创]最simple的问题请教  (http://bbs.xml.org.cn/dispbbs.asp?boardid=1&rootid=&id=5649)


--  作者:suzena
--  发布时间:3/14/2004 5:48:00 PM

--  [原创]最simple的问题请教
当我分别用记事本编辑出以下.xml和.xsl后,执行命令msxsl g:\1.xml g:\1.xsl -o g:\1.htm却没有得到预期的结果。用IE浏览是一片空白。代码如下:
1.xml:
<?xml version="1.0" ?>
<document>
  Hello,XML!
</document>
1.xsl:
<xsl>
   <rule>
      <root/>
          <H1><children/></H1>
  </rule>
</xsl>
但是,若在1.xsl中将<H1><children/></H1>改为<H1>tttttttttt</H1>,则在浏览器中显示出<H1></H1>之间的内容(tttttttttt)来。
Why?Thank You!
--  作者:jadedrip
--  发布时间:3/15/2004 10:06:00 AM

--  
你没有使用任何模板,所以只能使用默认模板。 至于<rule><root><children/>等等元素有些莫名其妙,不知道你打算干嘛?
写个简单的xsl来匹配你的 xml 吧。
<?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" version="4.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<h1><xsl:value-of select="document"/></h1>
</html>

</xsl:template>
</xsl:stylesheet>

-----------------------
<xsl:template match="/"> 代表匹配根节点。


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