请教高手:样式单xsl的一个显示问题

eaglebear 2003-10-16 09:28:06
我的xml文件如下
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="14-10.xsl"?>
<PERIODIC_TABLE>
<ATOM STATE="GAS">
<MELTING_POINT UNITS="Kelvin">13.81</MELTING_POINT>
</ATOM>
</PERIODIC_TABLE>
14-10.xsl文件为:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="PERIODIC_TABLE"/>
</body>
</html>
</xsl:template>
<xsl:template match="PERIODIC_TABLE">
<xsl:apply-templates select="//MELTING_POINT"/>
</xsl:template>
<xsl:template match="MELTING_POINT">
<p>
<xsl:value-of select="from-parent(ATOM)"/>
</p>
</xsl:template>
</xsl:stylesheet>
请问为何不能正常显示,以上代码问题出在什么地方,谢谢。
...全文
28 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
dory 2003-10-20
  • 打赏
  • 举报
回复
这条语句你想用来做什么呀?
eaglebear 2003-10-20
  • 打赏
  • 举报
回复
请问dory(打鱼船):"./from-parent"可否有其他形式替代
eaglebear 2003-10-17
  • 打赏
  • 举报
回复
应该有内容吧
wolf004 2003-10-17
  • 打赏
  • 举报
回复
去掉后面的()就都能用了!
我试过了!
我的xml文件如下
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="14-10.xsl"?>
<PERIODIC_TABLE>
<ATOM STATE="GAS">
<MELTING_POINT UNITS="Kelvin">13.81</MELTING_POINT>
</ATOM>
</PERIODIC_TABLE>
14-10.xsl文件为:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="PERIODIC_TABLE"/>
</body>
</html>
</xsl:template>
<xsl:template match="PERIODIC_TABLE">
<xsl:apply-templates select="//MELTING_POINT"/>
</xsl:template>
<xsl:template match="MELTING_POINT">
<p>
<xsl:value-of select="from-parent"/>
</p>
</xsl:template>
</xsl:stylesheet>
但没有显示的内容
eaglebear 2003-10-17
  • 打赏
  • 举报
回复
像from-parent(),from-childrend(),position()
等函数总是不能应用到ie中,请问这是怎么回事?
wolf004 2003-10-17
  • 打赏
  • 举报
回复
不好意思这样没有!我也试不出来!
from-parent(ATOM)东西有错误!换成.就对了
wolf004 2003-10-17
  • 打赏
  • 举报
回复
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="PERIODIC_TABLE/ATOM/"/>
</body>
</html>
</xsl:template>
<xsl:template match="ATOM">
<xsl:apply-templates select="MELTING_POINT"/>
</xsl:template>
<xsl:template match="MELTING_POINT">
<p>
<xsl:value-of select="from-parent(ATOM)"/>
</p>
</xsl:template>
</xsl:stylesheet>

这样试试
wolf004 2003-10-17
  • 打赏
  • 举报
回复
<xsl:template match="PERIODIC_TABLE">
<xsl:apply-templates select="/PERIODIC_TABLE/ATOM/MELTING_POINT"/>
</xsl:template>
eaglebear 2003-10-17
  • 打赏
  • 举报
回复

dory 2003-10-17
  • 打赏
  • 举报
回复
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="PERIODIC_TABLE"/>
</body>
</html>
</xsl:template>
<xsl:template match="PERIODIC_TABLE">
<xsl:apply-templates select="//MELTING_POINT/text()"/>
</xsl:template>
<xsl:template match="MELTING_POINT">
<p>
<xsl:value-of select="./from-parent"/>
</p>
</xsl:template>
</xsl:stylesheet>
eaglebear 2003-10-17
  • 打赏
  • 举报
回复
up
eaglebear 2003-10-16
  • 打赏
  • 举报
回复
给出的提示是:
方法未知。 -->from-parent(ATOM<--)

8,906

社区成员

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

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