XSLT转换xml为html不成功(新手真情提问)

squirrel_1976 2002-12-15 05:55:41
source.xml如下

<?xml version="1.0" encoding="gb2312"?>
<?xml-stylesheet type="text/xsl" href="XBRL.xslt"?>
<group xmlns="http://www.xbrl.org/2001/instance" xmlns:nasdaq="http://www.nasdaq.com/xbrl/demo" xmlns:ci="http://www.xbrl.org/us/gaap/ci/2000-07-31" xmlns:link="http://www.xbrl.org/2001/XLink/xbrllinkbase" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:msft="http://www.microsoft.com/msft/xbrl" xsi:schemaLocation="http://www.xbrl.org/2001/instance xbrl-instance.xsd http://www.nasdaq.com/xbrl/demo nasdaqdemo.xsd http://www.xbrl.org/us/gaap/ci/2000-07-31 us-gaap-ci-2001-v2-simplified.xsd http://www.microsoft.com/msft/xbrl MSFTv2_FY02.xsd">
<!-- SECTION: Entity Information -->
<ci:statements.entityInformation>
<ci:identifiers.entityName nonNumericContext="nNC4101">
ATMEL CORP
</ci:identifiers.entityName>
</ci:statements.entityInformation>
</group>

myStyle.xslt如下:
<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="gb2312" indent="yes"/>

<xsl:template match="/">
<html>
<head>
<title>
<xsl:value-of select="/group/ci:statements.entityInformation/ci:identifiers.entityName"/>
</title>
</head>
<body>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

就这样一个value-of都搞不定,在IE(6。0)上就出现这样的乱码:
0R*g餢f剉 T饄zz魰MR: 'ci'剉_(u0
我想请教高手们,
1.上面的错误在哪里?
2.有没有一种调试工具可以让自己清楚错在哪里,而不是浏览器上的乱码?
3.我下了一个XSLT Viewer,但用它老说:
The XSLT Viewer requires:
Internet Explorer Version 5 or above
IE Page
MSXML 3.0
MSXML
实际上我的条件全满足,最后去下了一个msxml4装了,还不行,不知何故?
...全文
32 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
squirrel_1976 2002-12-16
  • 打赏
  • 举报
回复
明明已经给分了啊,刚刚显示的还有,怎么会???
squirrel_1976 2002-12-16
  • 打赏
  • 举报
回复
哦,果然!谢谢你了,可能以后还会遇到很多问题,你有msn吗?我的zhengyunchen@msn.com。以后在线请教。谢谢啦,先给分。
saucer 2002-12-16
  • 打赏
  • 举报
回复
I used Xselerator, just look at the title of the browser, or try

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:my="http://www.xbrl.org/2001/instance"
xmlns:nasdaq="http://www.nasdaq.com/xbrl/demo"
xmlns:ci="http://www.xbrl.org/us/gaap/ci/2000-07-31"
>
<xsl:output method="html" version="1.0" encoding="gb2312" indent="yes"/>

<xsl:template match="/">
<html>
<head>
<title>
</title>
</head>
<body>
<xsl:value-of select="/my:group/ci:statements.entityInformation/ci:identifiers.entityName"/>
</body>
</html>
</xsl:template>

</xsl:stylesheet>
squirrel_1976 2002-12-16
  • 打赏
  • 举报
回复
真奇怪,我把上面的代码(两份都是)原样拷贝过来,仍然没有输出结果。我想知道,你的上面产生的代码是从浏览器里“查看源代码”看到的,还是有新的一个html文件?
saucer 2002-12-16
  • 打赏
  • 举报
回复
it is there, in the title, here is what I got on my machine:

<html xmlns:my="http://www.xbrl.org/2001/instance" xmlns:nasdaq="http://www.nasdaq.com/xbrl/demo" xmlns:ci="http://www.xbrl.org/us/gaap/ci/2000-07-31">
<head>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>
ATMEL CORP
</title>
</head>
<body>
</body>
</html>
squirrel_1976 2002-12-15
  • 打赏
  • 举报
回复
steeven,我会去找spy5的,不过你能告诉我viewer为什么不能使用吗?谢谢啦。
squirrel_1976 2002-12-15
  • 打赏
  • 举报
回复
saucer你好!这样是不会出错了,但却没有数据显示,本来应该有“ATMEL CORP”的。帮我看看好吗,现在我还完全不懂。先研究一下相关资料。
steeven 2002-12-15
  • 打赏
  • 举报
回复
调试xsl建议使用xmlspy5的单步调试功能.
另外msnd里面提供一个基于IE的xslt转换结果查看工具.
saucer 2002-12-15
  • 打赏
  • 举报
回复
copy the namespaces into your stylesheet,for example:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:my="http://www.xbrl.org/2001/instance"
xmlns:nasdaq="http://www.nasdaq.com/xbrl/demo"
xmlns:ci="http://www.xbrl.org/us/gaap/ci/2000-07-31"
>
<xsl:output method="html" version="1.0" encoding="gb2312" indent="yes"/>

<xsl:template match="/">
<html>
<head>
<title>
<xsl:value-of select="/my:group/ci:statements.entityInformation/ci:identifiers.entityName"/>
</title>
</head>
<body>
</body>
</html>
</xsl:template>

</xsl:stylesheet>
squirrel_1976 2002-12-15
  • 打赏
  • 举报
回复
对了忘了交待我的环境:
Windows XP
XML Spy 4
IE 6.0

8,906

社区成员

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

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