Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/348.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
java中html的Xsl转换_Java_Html_Xslt_Saxon - Fatal编程技术网

java中html的Xsl转换

java中html的Xsl转换,java,html,xslt,saxon,Java,Html,Xslt,Saxon,我想使用xsl提取部分html: <td> <div> <table> <tbody> <tr><td></td><td></td></tr> </tbody> <tfoot> <

我想使用xsl提取部分html:

<td>    
    <div>    
        <table>    
        <tbody>      
            <tr><td></td><td></td></tr>     
        </tbody>
        <tfoot>   
            <tr>   
                <td></td>    
                <td class="comment-form"><form id="add-comment-586631"></form></td>    
            </tr>    
        </tfoot>   
        </table>   
    </div>   
    <a id="comments-link-586631" class="comments-link" data-comments-count="0" title="ask author for clarification about this post">add comment</a>   
</td>

添加注释
我想制作这个(div中的任何内容):


我尝试了几个与此示例相关的排列,但无法使用:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:x="http://india.com/states">
    <xsl:strip-space elements="*" />
    <xsl:output indent="yes" method="html" />
    <xsl:template match="//div/node()">
            <xsl:copy-of select="*" />
            <xsl:apply-templates />
    </xsl:template>
</xsl:stylesheet>


有人能指出我遗漏了什么吗。谢谢

如果您只想复制div元素的后代(无需进一步处理),以下操作应该可以:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:strip-space elements="*" />
   <xsl:output indent="yes" method="html" />

   <xsl:template match="div/node()">
      <xsl:copy-of select="." />
   </xsl:template>

   <xsl:template match="text()"/>
</xsl:stylesheet>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:strip-space elements="*" />
   <xsl:output indent="yes" method="html" />

   <xsl:template match="div/node()">
      <xsl:copy-of select="." />
   </xsl:template>

   <xsl:template match="text()"/>
</xsl:stylesheet>