방정식을 첫 번째 점을 기준으로 두 부분으로 나누는 방법을 제안하십시오. 이전에 michael.hor257k의 BREAK 주석 텍스트를 기반으로 suggestion to Split the Equation을 얻었으므로 이제는 기간별로 분할해야합니다.첫 번째 점 (.)을 기준으로 방정식을 분할하십시오.
XML :
<root>
<body><sec><title>The sec 1</title><p>Text 1</p></sec></body>
<inline-formula>
<math display="inline">
<mi>A</mi>
<mn>4.651</mn>
<mi>The next text</mi>
</math>
</inline-formula>
<inline-formula>
<math display="inline">
<mrow>
<mrow><mi>B</mi></mrow>
<mrow><mn>4.651</mn></mrow>
</mrow>
<mi>The next text</mi>
</math>
</inline-formula>
</root>
XSLT :
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="root" select="//inline-formula/*" />
<xsl:template match="/">
<xsl:for-each select="//inline-formula">
<xsl:for-each select="text()">
<xsl:if test="contains(., '.')">
<xsl:apply-templates select="$root">
<xsl:with-param name="i" select="." tunnel="yes"/>
</xsl:apply-templates>
</xsl:if>
</xsl:for-each >
</xsl:for-each>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:param name="i" tunnel="yes"/>
<xsl:if test="descendant-or-self::text()[contains(., '.')]">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
필수 결과 : 당신이 태어나 셨 이유도
<root>
<body><sec><title>The sec 1</title><p>Text 1</p></sec></body>
<inline-formula>
<math display="inline">
<mi>A</mi>
<mn>4.</mn>
</math>
</inline-formula>
<inline-formula>
<math display="inline">
<!--Text node, before dot is removed -->
<mn>651</mn>
<mi>The next text</mi>
</math>
</inline-formula>
<inline-formula>
<math display="inline">
<mrow>
<mrow><mi>B</mi></mrow>
<mrow><mn>4.</mn></mrow>
</mrow>
</math>
</inline-formula>
<inline-formula>
<math display="inline">
<mrow>
<!--Text node, before dot is removed -->
<mrow><mn>651</mn></mrow>
</mrow>
<mi>The next text</mi>
</math>
</inline-formula>
</root>
및 XSLT 코너를보십시오. _tag 시스템 _을 올바르게 사용하는 법을 배우십시오. XSLT 2.0에 대한 질문은 그와 같이 태그를 붙여야합니다. –