输入xml:
<body>
<ce:sections>
<ce:section>
<ce:label>1</ce:label>
<ce:section-title>Introduction and main results</ce:section-title>
<ce:para> The existence of a globally hyperbolic Lorentzian metric on a
<mml:math>(3 + 1)</mml:math>
-spacetime with closed Cauchy surface excludes all but one differentiable structure on the underlying manifold, as observed by ChernovNemirovski
<citegroup>[
<cite>
<no>CN13</no>
<id>CN</id>
</cite>
]</citegroup>
</ce:para>
</ce:section>
</ce:sections>
</body>
如何检查<mml:math>
.... </mml:math>
和<citegroup>
... </citegroup>
是输入xml中body/ce:section/ce:sections
路径的子元素XSLT?
如何使用xslt获取<mml: math>
的路径?
答案 0 :(得分:0)
要检查一个节点是否从另一个节点下降,请使用ancestor
。例如:
<xsl:template match="mml:math">
<xsl:if test="ancestor::ce:section">
<xsl:text>This math node IS inside a section</xsl:text>
</xsl:if>
</xsl:template>
如何通过here询问如何确定节点的路径。你可能会发现有助于讨论的想法。