Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用xsl:include后不显示xml表数据(用于每个循环)_Xml_Xslt_Include - Fatal编程技术网

使用xsl:include后不显示xml表数据(用于每个循环)

使用xsl:include后不显示xml表数据(用于每个循环),xml,xslt,include,Xml,Xslt,Include,您好,我对xsl:import有问题。当我尝试导入一行图片作为页面的标题时,表格数据将从另一个xsl文件中消失。如果我把进口品拿走就好了。 任何帮助都将不胜感激。 这是我到目前为止的代码 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:include href="topinclude.xsl"/> <xsl:template match

您好,我对xsl:import有问题。当我尝试导入一行图片作为页面的标题时,表格数据将从另一个xsl文件中消失。如果我把进口品拿走就好了。 任何帮助都将不胜感激。 这是我到目前为止的代码

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="topinclude.xsl"/>

    <xsl:template match="allIreland">
        <html>
        <head>
        <link rel="stylesheet" type="text/css" href="dublin.css"/>
        </head>
        <body>



            <div id="firstYear">

            <table border="1">
            <caption>Dublin V Longford</caption>

                <tr>
                    <th>NUMBER</th>
                    <th>NAME</th>
                    <th>AGE</th>
                    <th>POSITION</th>
                    <th>CLUB</th>
                </tr>
                <xsl:for-each match="allIreland/year[@id='1976']/team/player[@id='2b'or@id='2b'or@id='2c'or@id='2d'or@id='2e'or@id='2g'or@id='2h'or@id='2j'or@id='2k'or@id='2l'or@id='2o'or@id='2q'or@id='2r'or@id='2s'or@id='2t'or@id='2u']">
                <tr> 
                    <td><xsl:value-of select="number"/></td>
                    <td><xsl:value-of select="name"/></td>
                    <td><xsl:value-of select="age"/></td>
                    <td><xsl:value-of select="position"/></td>
                    <td><xsl:value-of select="club"/></td>


                </tr>

           </table>

               <table border="1">
            <caption>Dublin V Laois</caption>

                <tr>
                    <th>NUMBER</th>
                    <th>NAME</th>
                    <th>AGE</th>
                    <th>POSITION</th>
                    <th>CLUB</th>
                </tr>
                <xsl:for-each select="allIreland/year[@id='1976']/team/player[@id='2a'or@id='2c'or@id='2d'or@id='2e'or@id='2q'or@id='2f'or@id='2g'or@id='2k'or@id='2l'or@id='2o'or@id='2p'or@id='2r'or@id='2s'or@id='2t'or@id='2u']">
                <tr>
                    <td><xsl:value-of select="number"/></td>
                    <td><xsl:value-of select="name"/></td>
                    <td><xsl:value-of select="age"/></td>
                    <td><xsl:value-of select="position"/></td>
                    <td><xsl:value-of select="club"/></td>
                </tr>
            </xsl:for-each>
           </table>
               <table border="1">
            <caption>Dublin V Meath</caption>

                <tr>
                    <th>NUMBER</th>
                    <th>NAME</th>
                    <th>AGE</th>
                    <th>POSITION</th>
                    <th>CLUB</th>
                </tr>
                <xsl:for-each select="allIreland/year[@id='1976']/team/player[@id='2a'or@id='2c'or@id='2d'or@id='2e'or@id='2g'or@id='2q'or@id='2i'or@id='2k'or@id='2m'or@id='2o'or@id='2p'or@id='2r'or@id='2s'or@id='2t'or@id='2u']">
                <tr>
                    <td><xsl:value-of select="number"/></td>
                    <td><xsl:value-of select="name"/></td>
                    <td><xsl:value-of select="age"/></td>
                    <td><xsl:value-of select="position"/></td>
                    <td><xsl:value-of select="club"/></td>
                </tr>
            </xsl:for-each>
           </table>
               <table border="1">
            <caption>Dublin V Galway</caption>

                <tr>
                    <th>NUMBER</th>
                    <th>NAME</th>
                    <th>AGE</th>
                    <th>POSITION</th>
                    <th>CLUB</th>
                </tr>
                <xsl:for-each select="allIreland/year[@id='1976']/team/player[@id='2a'or@id='2c'or@id='2d'or@id='2e'or@id='2f'or@id='2h'or@id='2j'or@id='2i'or@id='2k'or@id='2l'or@id='2o'or@id='2p'or@id='2r'or@id='2t'or@id='2v']">
                <tr>
                    <td><xsl:value-of select="number"/></td>
                    <td><xsl:value-of select="name"/></td>
                    <td><xsl:value-of select="age"/></td>
                    <td><xsl:value-of select="position"/></td>
                    <td><xsl:value-of select="club"/></td>
                </tr>
            </xsl:for-each>
           </table>
               <table border="1">
            <caption>Dublin V Kerry</caption>

                <tr>
                    <th>NUMBER</th>
                    <th>NAME</th>
                    <th>AGE</th>
                    <th>POSITION</th>
                    <th>CLUB</th>
                </tr>
                <xsl:for-each select="allIreland/year[@id='1976']/team/player[@id='2a'or@id='2c'or@id='2d'or@id='2e'or@id='2f'or@id='2q'or@id='2i'or@id='2k'or@id='2l'or@id='2l'or@id='2o'or@id='2p'or@id='2r'or@id='2s'or@id='2t'or@id='2v']">
                <tr>
                    <td><xsl:value-of select="number"/></td>
                    <td><xsl:value-of select="name"/></td>
                    <td><xsl:value-of select="age"/></td>
                    <td><xsl:value-of select="position"/></td>
                    <td><xsl:value-of select="club"/></td>
                </tr>
            </xsl:for-each>
           </table>
           </div>
          </body>
        </html>
      </xsl:template>
    </xsl:stylesheet> 


    // and here is the include header

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

    <xsl:template match="/" priority="10">
    <html>
    <head><title>Header</title></head>
    <body>
        <div id="header">
    <img src="gaa1.jpg"/>
    <img src="gaa2.jpg"/>
      <img src="gaa1.jpg"/>
      <img src="gaa2.jpg"/>
      <img src="gaa1.jpg"/>
      </div>

    <xsl:apply-templates/>
</body>
</html>
</xsl:template>
</xsl:transform>

一个问题是XSLT(主模板和包含的topinclude.xsl)都会生成带有HTML开始/结束标记、标题、正文等的完整HTML页面,因此结果将是一个HTML页面,其标题来自topinclude.xsl,其中包含由中包含的模板生成的第二个HTML页面。
由于topinclude.xsl包含在顶部,您应该将主模板的,因为dublin.css include,移动到topinclude.xsl,并从包含模板中删除,和标记。

您的第一个示例具有嵌套的xsl:templates,这是不允许的,所以我不认为包含是问题所在。那不应该在那里,我把它放在那里,看看它是否会改变什么。我在上传到这里之前忘了把它拿出来。