菜鸟的菜鸟问题体,XML不能通过SXL转换成网页

hayes56k 2003-10-20 12:44:51
<?xml version="1.0" encoding="gb2312" ?>
<?xml-stylesheet type="text/xsl" href="first.xsl"?>
<!DOCTYPE text
[
<!ELEMENT text (student)>
<!ELEMENT student (player,score1,score2)>
<!ATTLIST player id ID #REQUIRED
name CDATA #IMPLIED
class NMTOKEN "111">
]>
<text xmlns="127.0.0.1"
xmlns:myspace="www.163.xom">
<student>
<myspace:player id="1" name="lll" class="aaa">vivian</myspace:player>
<score1>20</score1>
<score2>40</score2>
</student>
<student>
<myspace:player id="2" name="zzz" class="bbb">jaoanna</myspace:player>
<score1>20</score1>
<score2>40</score2>
</student>
</text>


SXLSXLSXL
<?xml version="1.0" encoding="gb2312" ?>
<xsl:stylesheet1 xmlns:xsl="127.0.0.1">
<xsl:template match="/">
<html>
<title>firstxsl</title>
<body>
<h2 align="center">firstxsl</h2>
<xsl:apple-template select="text/student"/>
</body>
</html>
</xsl:template>

<xsl:template match="text/student">
<table border="1" cellpadding="0" align="center">
<tr>
<th>name</th>
<th>score1</th>
<th>score2</th>
</tr>
<xsl:for-each select="text/student" order-by="-score1">
<tr>
<td><xsl:value-of select="player"/></td>
<td><xsl:value-of select="score1"/></td>
<td><xsl:value-of select="score2"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet1>
...全文
64 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
saucer 2003-10-20
  • 打赏
  • 举报
回复
try this in IE6:


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:my="127.0.0.1"
xmlns:myspace="www.163.xom"
>
<xsl:template match="/">
<html>
<title>firstxsl</title>
<body>
<h2 align="center">firstxsl</h2>
<xsl:apply-templates select="my:text"/>
</body>
</html>
</xsl:template>

<xsl:template match="my:text">
<table border="1" cellpadding="0" align="center">
<tr>
<th>name</th>
<th>score1</th>
<th>score2</th>
</tr>
<xsl:for-each select="my:student">
<xsl:sort select="score1" order="descending" />
<tr>
<td><xsl:value-of select="myspace:player"/></td>
<td><xsl:value-of select="my:score1"/></td>
<td><xsl:value-of select="my:score2"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>

8,906

社区成员

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

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