Xml XSLT使用文本中断节点

Xml XSLT使用文本中断节点,xml,xslt-2.0,Xml,Xslt 2.0,我有一个包含文本和节点的节点,在XSLT2.0中,我必须创建一个新节点,该节点包含节点前面的文本。 例如: 纹状肌 ...................... 这是一种肌肉运动,是系统科学共同控制的运动 ...................... . 乐 ...................... 位于康塔托-特拉-迪洛罗的cui le ossa entrano的sono-le区。 结果必须如下所示: <answer> I muscoli stri

我有一个包含文本和节点的节点,在XSLT2.0中,我必须创建一个新节点,该节点包含节点前面的文本。 例如:


纹状肌
...................... 
这是一种肌肉运动,是系统科学共同控制的运动
......................
. 乐
...................... 
位于康塔托-特拉-迪洛罗的cui le ossa entrano的sono-le区。
结果必须如下所示:

   <answer>
        I muscoli striati o 
        <correct>......................</correct> 
   </answer>
   <answer>
        sono detti anche muscoli volontari, perché il loro movimento è controllato coscientemente dal sistema <correct>......................</correct>
   </answer>
   <answer>
         . Le <correct>......................</correct> 
   </answer>
   <answer>
        sono le zone in cui le ossa entrano in contatto tra di loro.
   </answer>

纹状肌
...................... 
这是一种肌肉运动,是系统科学共同控制的运动。。。。。。。。。。。。。。。。。。。。。。
. 乐。。。。。。。。。。。。。。。。。。。。。。
位于康塔托-特拉-迪洛罗的cui le ossa entrano的sono-le区。

使用XSLT 2.0,您可以对每个组使用
xsl:

<?xml version="1.0" encoding="UTF-8"?>
<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:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()" />
        </xsl:copy>
    </xsl:template>

    <xsl:template match="answer">
        <data>
            <xsl:for-each-group select="node()" group-ending-with="correct">
                <answer>
                    <xsl:apply-templates select="current-group()" />
                </answer>
            </xsl:for-each-group>
        </data>
    </xsl:template>
</xsl:stylesheet>

<?xml version="1.0" encoding="UTF-8"?>
<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:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()" />
        </xsl:copy>
    </xsl:template>

    <xsl:template match="answer">
        <data>
            <xsl:for-each-group select="node()" group-ending-with="correct">
                <answer>
                    <xsl:apply-templates select="current-group()" />
                </answer>
            </xsl:for-each-group>
        </data>
    </xsl:template>
</xsl:stylesheet>