Xml 如何在xslt中拆分元素值并使用新元素标记名分配这些值
我的输入xml:Xml 如何在xslt中拆分元素值并使用新元素标记名分配这些值,xml,xslt,Xml,Xslt,我的输入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
<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>
平面上全局双曲洛伦兹度量的存在性
(3 + 1)
-正如切尔诺夫涅米罗夫斯基所观察到的那样,具有闭合柯西曲面的时空排除了底层流形上除一个可微结构之外的所有结构
[
CN13
CN
]
我们在这篇文章中指出,一个全局双曲的微分同胚型
(n+1)
-时空是由闭合柯西曲面的h-共基类决定的。具体声明如下。
我的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>
平面上全局双曲洛伦兹度量的存在性
(
3.
+
1.
)
-正如Chernov–Nemirovski所观察到的,具有闭合柯西曲面的时空排除了底层流形上除一个可微结构之外的所有结构
[CN13]。
我们在这篇文章中指出,一个全局双曲的微分同胚型
(
N
+
1.
)
-时空是由闭合柯西曲面的h-共基类决定的。具体声明如下。
刚刚更正了您的XSLT。您没有指定要使用的子元素mml:math
——以及[1]等
下面是我的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>
平面上全局双曲洛伦兹度量的存在性
(
3.
+
1.
)
-正如切尔诺夫涅米罗夫斯基所观察到的那样,具有闭合柯西曲面的时空排除了底层流形上除一个可微结构之外的所有结构
(
N
+
1.
)
我们在这篇文章中指出,一个全局双曲的微分同胚型
你为什么不花点时间让你的问题更具可读性呢?我想你是想把(3+1)
改成3+1
。如果是这样的话,简化您的示例来展示这一点可能会有所帮助。从XSLT中删除空行也会有所帮助。谢谢