从xsl中的另一个xml读取xpath

时间:2017-04-20 04:55:10

标签: xml xslt

我有一个存储xpath的xml文档

<Field col_header="Content ID " mapping="$contentTagRef/v41:contentId" />
<Field col_header="Channel (Mandatory)" mapping="v43:channelId" />
<Field col_header="HID (Mandatory)" mapping="v43:eventId" />
<Field col_header="TX Date (Mandatory)" mapping="$eventTimeStamp" />    
<Field col_header="TX Date (Mandatory)" mapping="$eventTimeStamp" />    

我有一个xsl,我需要在匹配的项目上迭代这些字段并检索值。

<!-- Reading the other document as -->
<xsl:param name="mappingsFile" select="document('SVT_input_Mappings.xml')" />
<xsl:template match="v43:event">

    <xsl:param name="contentTagRef"></xsl:param>
    <xsl:param name="materialTagRef"></xsl:param>
    <xsl:param name="eventTimeStamp"></xsl:param>
    <xsl:variable name="root">
        <xsl:value-of select="."></xsl:value-of>
    </xsl:variable>

    <xsl:for-each select="$mappingsFile//Field">

        <xsl:variable name="mapping">
            <xsl:value-of select="@mapping"></xsl:value-of>
        </xsl:variable>

        -- How to evaluate the mapping ?? -----
    </xsl:for-each>

我得到的输出

 $contentTagRef/v41:contentId 

相反,我期待

Content1-xx-454

0 个答案:

没有答案