首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

XML XSL显示有关问题,求解

2012-02-29 
XML XSL显示问题,求解请问下面这个XML文件在浏览器上显示的只有标题部分,而没有XML对应的内容,以下是代码~

XML XSL显示问题,求解
请问下面这个XML文件在浏览器上显示的只有标题部分,而没有XML对应的内容,以下是代码~非常各位的回答感谢!


这个是teamwork7.xml

XML code
<?xml version="1.0" encoding="ISO-8859-1"?><?xml-stylesheet type="text/xsl" href="teamwork7.xsl"?><movie_renting_shop xmlns="http://www.w3schools.com"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xsi:schemaLocation="http://www.w3schools.com teamwork7.xsd"><movie id="A21" category="action"><Name>A</Name><Year>1991</Year><Author>B</Author><Price unit="dollars">1</Price></movie><movie id="A22" category="drama"><Name>B</Name><Year>2000</Year><Author>B</Author><Price unit="dollars">2</Price></movie><movie id="A23" category="action"><Name>C</Name><Year>2008</Year><Author>C</Author><Price unit="dollars">3</Price></movie></movie_renting_shop>

这个是对应的teamwork7.xsl文件
XML code
<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">  <html>  <body>    <h2>A List of Movies and Customers</h2>    <table border="1">       <tr bgcolor="yellow">       <th>name</th>       <th>iD</th>       <th>year</th>       <th>author</th>       <th>price</th>       <th>category</th>       </tr>      <xsl:for-each select="movie_renting_shop/movie">        <tr>          <td><xsl:value-of select="Name"/></td>          <td><xsl:value-of select="Year"/></td>          <td><xsl:value-of select="Author"/></td>          <td><xsl:value-of select="Price"/></td>        </tr>      </xsl:for-each>    </table>  </body>  </html></xsl:template></xsl:stylesheet>


[解决办法]
namespace问题,去掉即可 <movie_renting_shop>


[解决办法]
XML code
<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:teamwork7="http://www.w3schools.com" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">  <html>  <body>    <h2>A List of Movies and Customers</h2>    <table border="1">       <tr bgcolor="yellow">       <th>name</th>       <th>iD</th>       <th>year</th>       <th>author</th>       <th>price</th>       <th>category</th>       </tr>      <xsl:for-each select="teamwork7:movie_renting_shop/teamwork7:movie">        <tr>          <td><xsl:value-of select="teamwork7:Name"/></td>          <td><xsl:value-of select="teamwork7:Year"/></td>          <td><xsl:value-of select="teamwork7:Author"/></td>          <td><xsl:value-of select="teamwork7:Price"/></td>        </tr>      </xsl:for-each>    </table>  </body>  </html></xsl:template></xsl:stylesheet> 

热点排行