show your mydoc1.xsl, or try to add this line to the top of your xml file<?xml-stylesheet type="text/xsl" href="mydoc1.xsl" ?>and then try to open the xml file in your browser

解决方案 »

  1.   

    你的方法我试过的,在游览器中可以打开的,可在程序中用xml控件进行xsl转换时就出错了
    我不明白为什么会这样
      

  2.   

    mydoc1.xml如下:
    <?xml version="1.0" standalone="no"?>
    <!--This is a sample XML document used for testing page-loading-->
    <instance>
      <instanceid>41_1</instanceid>
      <clsid>41</clsid>
      <clsname>试飞阶段故障案例</clsname>
      <attributes>
        <attribvalue attribtype="其它">
          <attribname>编号</attribname>
          <attribunit />
          <description>2004062401</description>
        </attribvalue>
    </instance>mydoc1.xsl如下:
    <?xml version="1.0" encoding="UTF-8" ?>
    <stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
      <html>
         <head>
            <title>基于KM、面向产品创新的可重构设计仓库平台</title>
         </head>
         <body>
            <xsl:value-of select="clsname"/>
            <xsl:apply-templates/>
         </body>
      </html>
    </xsl:template><xsl:template match="attributes">
      <table> 
        <xsl:apply-templates/>
      </table>
    </xsl:template><xsl:template match="attribvalue[@attribtype='其它']">
      <tr><td valign='top' ><xsl:value-of select="attribname"/></td>
          <td valign='top' style='width:500px;word-break:break-all;'><xsl:value-of select="description"/></td>
      </tr>
    </xsl:template>
    </stylesheet>