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

使用XSL有关问题

2012-02-25 
使用XSL问题XSL文件:xsl:stylesheetversion 1.0 xmlns:xsl http://www.w3.org/1999/XSL/Transform

使用XSL问题
XSL文件:
<xsl:stylesheet   version= "1.0 "   xmlns:xsl= "http://www.w3.org/1999/XSL/Transform "   >

      <xsl:template   match= "/ ">
                  <html>
                  <table   width= "100% "   border= "1 ">
                      <tr>
                      <th   width= "150 "> 书名 </th> <th   width= "40 "> 书号 </th>
                      <th   width= "40 "> 定价 </th> <th   width= "120 "> 作者 </th>
                      <th   width= "120 "> 图片 </th> <th> 详细信息 </th>
                      </tr>
                  <xsl:apply-templates   select= "//book "   order-by= "+书号 "/>
                  </table>
                  </html>
      </xsl:template>

      <xsl:template   match= "book ">
                      <tr>
                      <td   width= "150 "> <xsl:value-of   select= "书名 "/> </td>
                      <td   width= "40 "> <xsl:value-of   select= "书号 "/> </td>
                      <td   width= "40 "> <xsl:value-of   select= "定价 "/> </td>
                      <td   width= "120 "> <xsl:value-of   select= "作者 "/> </td>
                      <td   width= "120 "> <xsl:value-of   select= "图片 "/> </td>
                      <td   > <xsl:value-of   select= "详细信息 "/> </td>
                      </tr>
      </xsl:template>
</xsl:stylesheet>

ASP文件:
<%   Response.ContentType= "text/xml "   %>
  <?xml   version= "1.0 "   encoding= "GB2312 "   ?>
  <?xml-stylesheet   type= "text/xsl "   href= "style.xsl "   ?>
  <booklist>
    <%   Do   Until   rsbooklist.EOF   %>
      <book>
          <书名> <%=rsbooklist( "Title ")%> </书名>
  <书号> <%=rsbooklist( "BookNo ")%> </书号>
  <定价> <%=rsbooklist( "Price ")%> </定价>


  <图片> <%=rsbooklist( "BookNo ")%> .jpg </图片>
  <详细信息> Details.asp?   BookNo= <%=rsbooklist( "BookNo ")%> </详细信息>
  <%   bookno=rsbooklist( "BookNo ")
    Dim   rsAuthorlist
    Set   rsAuthorlist   =cn_ebookstore.Execute( "SELECT   AuthorList.Name   FROM   AuthorList,BookAuthorList   WHERE   (BookAuthorList.BookNo= ' "&   bookno   &   " '   AND   BookAuthorList.AuthorNO=AuthorList.AuthorNO) ")
    Do   Until   rsAuthorList.EOF   %>
    <作者> <%=rsAuthorList( "Name ")%> </作者>
    <%   rsAuthorList.MoveNext  
            Loop  
    rsAuthorList.Close   %>
      </book>
    <%   rsbooklist.MoveNext  
      Loop   %>
  </booklist>
输出的内容一直是XML文件,排版的XSL好象没有起到作用,急等高手解答.....
叩谢了!!!

[解决办法]
<xsl:stylesheet version= "1.0 " xmlns:xsl= "http://www.w3.org/1999/XSL/Transform " >
<xsl:output method= "html " encoding= "gb2312 " media-type= "text/html "/>
<xsl:template match= "/ ">
...

热点排行