如何将来自<xsl:value-of =“” select =“ @”>的字段放入标记内?

时间:2019-02-18 12:07:52

标签: xslt

我不能在标签内添加带有(<xsl:value-of select=)的字段

我正在创建一个XSLT模板,该模板将数据从Excel转换为XML。一切正常,但现在我想将excel用户名(@User_Name)添加到userdata标签。

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
    <tXML>
        <Header>
            <Source>TESTE</Source>
            <Action_Type>Upgrade</Action_Type>
            <Message_Type>User</Message_Type>
            <Company_ID>200000002</Company_ID>
            <Msg_Locale>English (United Kingdom)</Msg_Locale>
            <Internal_Date_Time_Stamp>08/09/2017 17:35:00</Internal_Date_Time_Stamp>
        </Header>
        <Message>               
            <xsl:for-each select="//rs:data">
                <xsl:apply-templates/>
            </xsl:for-each>
        </Message>
    </tXML>
</xsl:template>
<xsl:template match="//z:row">
    <UserData  User_Name="{@User_Name}">
        <xsl:value-of select="@User_Name"/>
        <User>
            <Company_Name>
                <xsl:value-of select="@Company_Name"/>
            </Company_Name>
            <Location_Name>
                <xsl:value-of select="@Location_Name"/>
            </Location_Name>
            <Role_Name>
                <xsl:value-of select="@Role_Name"/>
            </Role_Name>
            <User_Name>
                <xsl:value-of select="@User_Name"/>
            </User_Name>
            <First_Name>
                <xsl:value-of select="@First_Name"/>
            </First_Name>
            <Last_Name>
                <xsl:value-of select="@Last_Name"/>
            </Last_Name>
            <Solutions>
                <RestrictedSolution>TESTE</RestrictedSolution>
            </Solutions>
        </User>
    </UserData>
</xsl:template>
</xsl:stylesheet>

0 个答案:

没有答案