我的输入xml:
<body xmlns:ce="test.com" xmlns:mml="any.com">
<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>
We point out in this note that the diffeomorphism type of a globally hyperbolic
<mml:math>(n+ 1)</mml:math>
-spacetime is determined by the h-cobordism class of its closed Cauchy surface. The precise statement is as follows.
</ce:para>
我的xslt是;
<body>
<xsl:apply-templates select="body/ce:para"/>
</body>
<xsl:template match="body/ce:para">
<xsl:value-of select="ce:para/text[1]"/>
<mml:mo stretchy="false">(</mml:mo>
<mml:mn>
<xsl:value-of select="translate(substring-after(substring-before(mml:math,'+'),'('),' ','')"/>
</mml:mn>
<mml:mo>
<xsl:text>+</xsl:text>
</mml:mo>
<mml:mn>
<xsl:value-of select="translate(substring-before(substring-after(mml:math,'+'),')'),'
','')"/>
</mml:mn>
<mml:mo stretchy="false">)</mml:mo>
<xsl:value-of select="ce:para/text[2]"/>
<mml:mo stretchy="false">(</mml:mo>
<mml:mi>
<xsl:value-of select="translate(substring-after(substring-before(mml:math,'+'),'('),' ','')"/>
</mml:mi>
<mml:mo>
<xsl:text>+</xsl:text>
</mml:mo>
<mml:mn>
<xsl:value-of select="translate(substring-before(substring-after(mml:math,'+'),')'),' ','')"/>
</mml:mn>
<mml:mo stretchy="false">)</mml:mo>
<xsl:value-of select="ce:para/text[3]"/>
</xsl:template>
我的预期输出xml:
<body>
<ce:para id="p0005">
The existence of a globally hyperbolic Lorentzian metric on a
<mml:mo stretchy="false">(</mml:mo>
<mml:mn>3</mml:mn>
<mml:mo>+</mml:mo>
<mml:mn>1</mml:mn>
<mml:mo stretchy="false">)</mml:mo>
</mml:math>
-spacetime with closed Cauchy surface excludes all but one differentiable structure on the underlying manifold, as observed by Chernov–Nemirovski
<ce:cross-ref>[CN13]</ce:cross-ref>.
We point out in this note that the diffeomorphism type of a globally hyperbolic
<mml:mo stretchy="false">(</mml:mo>
<mml:mi>n</mml:mi>
<mml:mo>+</mml:mo>
<mml:mn>1</mml:mn>
<mml:mo stretchy="false">)</mml:mo>
</mml:math>
-spacetime is determined by the <ce:italic>h</ce:italic>-cobordism class of its closed Cauchy surface. The precise statement is as follows.
</ce:para>
</body>
答案 0 :(得分:0)
刚刚纠正了你的XSLT。您错过了使用[1]等指定要采用的子元素mml:math
。
这是我的XSLT代码,非常简化您的任务。到目前为止你没有映射的是citegroup
,但现在你将管理它:
<xsl:template match="body/ce:para">
<xsl:value-of select="text()[1]"/>
<xsl:apply-templates select="mml:math[1]"/>
<xsl:value-of select="text()[2]"/>
<xsl:apply-templates select="mml:math[2]"/>
<xsl:value-of select="text()[3]"/>
</xsl:template>
<xsl:template match="mml:math">
<mml:mo stretchy="false">(</mml:mo>
<mml:mn>
<xsl:value-of select="translate(substring-after(substring-before(text(),'+'),'('),' ','')"/>
</mml:mn>
<mml:mo>
<xsl:text>+</xsl:text>
</mml:mo>
<mml:mn>
<xsl:value-of select="translate(substring-before(substring-after(text(),'+'),')'),'
','')"/>
</mml:mn>
<mml:mo stretchy="false">)</mml:mo>
</xsl:template>
这创建了以下输出:
<body>
The existence of a globally hyperbolic Lorentzian metric on a
<mml:mo stretchy="false">(</mml:mo>
<mml:mn>3</mml:mn>
<mml:mo>+</mml:mo>
<mml:mn>1</mml:mn>
<mml:mo stretchy="false">)</mml:mo>
-spacetime with closed Cauchy surface excludes all but one differentiable structure on the underlying manifold, as observed by ChernovNemirovski
<mml:mo stretchy="false">(</mml:mo>
<mml:mn>n</mml:mn>
<mml:mo>+</mml:mo>
<mml:mn>1</mml:mn>
<mml:mo stretchy="false">)</mml:mo>
We point out in this note that the diffeomorphism type of a globally hyperbolic
</body>