最简单的xsl & xml问题

kaplan 2004-06-19 10:54:53
我有一个很简单的xml文件:
loading.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="Loading.xsl"?>
<loadingInfo>
<empID name="Davids">e001</empID>
<from>9</from>
<to>17</to>
</loadingInfo>

想用loading.xsl转换为html,输出name:

<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://epm008/2004/XSL/Loading">
<xsl:output method="html"/>
<!--Æ¥ÅäÎĵµ¸ùÎļþ-->
<xsl:template match="/">
<html>
<head>
<title>First XSLT example</title>
</head>
<body>
<ul>
<xsl:apply-templates select="loadingInfo/empID"/>
</ul>
</body>
</html>
</xsl:template>
<xsl:template match="empID">
<p>employee name is a <xsl:value-of select="@name"/></p>
</xsl:template>
</xsl:stylesheet>


但是在浏览器(ie6)输出还是只有"employee name is a "
为什么会这样?这个已经是最简单的xsl转换了.....

...全文
146 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
oldjion 2004-06-23
  • 打赏
  • 举报
回复
在倒数第五行之前加apply-template
maowu 2004-06-19
  • 打赏
  • 举报
回复
o my god~~~~~~~~~~~~~~~~~`
原来这个命名空间还有意义的,我以为随便起的呢.
風鈴 2004-06-19
  • 打赏
  • 举报
回复
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
colee 2004-06-19
  • 打赏
  • 举报
回复
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
另外:
loading.xml:
<?xml version="1.0" encoding="UTF-8"?>
loading.xsl:
<?xml version="1.0" encoding="GB2312"?>
两个文件编码要一致!

8,909

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧