XML与XSL如何结合。(100分)

  • 主题发起人 20020509
  • 开始时间
2

20020509

Unregistered / Unconfirmed
GUEST, unregistred user!
我写了一段关于XML格式的语句,请问各为大侠为什么没有返回XSL设定的结果。
[blue][green]XML文件如下:[/green][/blue]
<?xml version='1.0' encoding='UTF-8'?>
<ROOT xmlns:sql='urn:schemas-microsoft-com:xml-sql'
sql:xsl='myxsl.xsl'>
<sql:query>
select firstname,lastname from employees for xml auto
</sql:query>
</ROOT>

 
[blue]XSL文件如下:[/blue]
<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet xmlns:xsl='http://www.w3.org/TR/WD-xsl' version='1.0'>

<xsl:template match='*'>
<xsl:apply-templates />
</xsl:template>

<xsl:template match='employees'>
<tr>
<td><xsl:value-of select='@firstname'/></td>
<td><B><xsl:value-of select='@lastname'/></B></td>
</tr>
</xsl:template>

<xsl:template match='/'>
<html>
<head>
<style>th{backgroud_color:#CCCCCC}</style>
</head>
<body>
<table border='1' style='width:300;'>
<tr><th colspan='2'>employees</th></tr>
<tr><th> first name </th><th> last name </th></tr>
<xsl:apply-templates select='employees' />
</table>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

 
<?xml version="1.0" encoding="GB2312" ?>
<?xml-stylesheet type="text/xsl" href="sm_xsl.xsl"?>
 
接受答案了.
 
顶部