Xml 如何在xslt 1中创建变量

Xml 如何在xslt 1中创建变量,xml,xslt,xslt-1.0,Xml,Xslt,Xslt 1.0,您能告诉我如何在变量中组合xml吗 输入xml <video> <a> <c> <d>hello</d> <d>jjjj</d> </c> </a> <b> <c> <d>test</d>

您能告诉我如何在变量中组合xml吗

输入xml

<video>
    <a>
        <c>
            <d>hello</d>
            <d>jjjj</d>
        </c>
    </a>
    <b>
        <c>
            <d>test</d>
            <d>sss</d>
        </c>
    </b>
</video>

你好
jjjj
测试
sss
代码

    <xsl:template match="video">
        <xsl:variable name="videoList">
            <video>
                <xsl:copy-of select="//./a/c"></xsl:copy-of>
                <xsl:copy-of select="//./b/c"></xsl:copy-of>

            </video>
        </xsl:variable>
        <xsl:copy-of select="$videoList"/>
  </xsl:template>

</xsl:stylesheet>

输出

<video>
    <c>
        <d>hello</d>
        <d>jjjj</d>
    </c>
    <c>
        <d>test</d>
        <d>sss</d>
    </c>
</video>
<video>
    <c>
        <d>hello</d>
        <d>jjjj</d>

        <d>test</d>
        <d>sss</d>
    </c>

</video>

你好
jjjj
测试
sss
预期产出

<video>
    <c>
        <d>hello</d>
        <d>jjjj</d>
    </c>
    <c>
        <d>test</d>
        <d>sss</d>
    </c>
</video>
<video>
    <c>
        <d>hello</d>
        <d>jjjj</d>

        <d>test</d>
        <d>sss</d>
    </c>

</video>

你好
jjjj
测试
sss

这个例子太抽象了,无法确定你想要的是什么。获得显示结果的一种方法是将变量定义为:

<xsl:variable name="videoList">
        <video>
            <c>
                <xsl:copy-of select="a/c/d | b/c/d"/>
            </c>
        </video>
</xsl:variable>

这个例子太抽象了,无法确定你想要的是什么。获得显示结果的一种方法是将变量定义为:

<xsl:variable name="videoList">
        <video>
            <c>
                <xsl:copy-of select="a/c/d | b/c/d"/>
            </c>
        </video>
</xsl:variable>

什么让你认为你需要一个变量?您只需执行以下操作:

<xsl:template match="video">
   <video>
     <c>
        <xsl:copy-of select=".//d"/>
     </c>
  </video>
</xsl:template>

什么让你认为你需要一个变量?您只需执行以下操作:

<xsl:template match="video">
   <video>
     <c>
        <xsl:copy-of select=".//d"/>
     </c>
  </video>
</xsl:template>


它不是当前答案..请检查预期输出它不是当前答案..请检查预期输出