变量不打印 xml 标签

variable not printing the xml tags

我正在使用以下代码:

<xsl:template name="employmentdates">
    <xsl:variable name="empdates">
    <xsl:for-each-group select="employment_information/job_information" group-adjacent="emplStatus">
        <xsl:if test="current-grouping-key() = 'A'">
            <xsl:variable name="Low">
                <xsl:for-each select="current-group()">
                    <xsl:if test="position() = 1">
                        <xsl:value-of select="start_date"/>
                    </xsl:if>
                </xsl:for-each>
            </xsl:variable>
            <emp_info>
                <start_date>
                    <xsl:value-of select="$Low"/>
                </start_date>
            </emp_info>
        </xsl:if>
    </xsl:for-each-group>
</xsl:variable>
<xsl:value-of select="$empdates"/>
</xsl:template>

在此我定义了一个变量 empdates,在该变量中我试图制作一个小的 xml 文件。但是当我试图打印变量 empdates 使用 xslt 代码 <xsl:value-of select="$empdates"/> 然后它只打印内容值(日期例如: 2016-10-20 )并且缺少 xml 标签 emp_info 和 start_date.

我期待这样的事情:

       <emp_info>
            <start_date>2016-10-20</start_date>
        </emp_info>

这就是 xsl:value-of 所做的 - 它创建了一个文本节点。你想要 xsl:copy-of.