这是XML文档。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
xmlns:v="urn:schemas-microsoft-com:vml">
<w:body>
<w:p>para1</w:p>
<w:tbl>table data 1</w:tbl>
<w:p>para2</w:p> <!-- have to check whether this node is w:tbl or not with respect to the context node below-->
<w:tbl>table data 2</w:tbl> <!-- Assume this is context node -->
</w:body>
</w:document>
所以,我想检查上下文节点[<w:p>para2</w:p>
] 的第一个前兄弟[<w:tbl>table data 2</w:tbl>
] <w:tbl
&gt; 与否。
请指导我摆脱这个问题...
答案 0 :(得分:6)
我想你要求
<xsl:if test="preceding-sibling::*[1]/self::w:p">....</xsl:if>