使用XSLT从xml获取Descriptor的值

时间:2015-03-27 04:00:46

标签: xml xslt

我需要获得" Descriptor"的价值。 (即"员工")从下面的代码到我的XSLT并将其分配给其他变量" Worker_Type1"

    <wd:Worker_Type wd:Descriptor="Employee">
       <wd:ID wd:type="WID">d588c41a446c11de98360015c5e6daf6</wd:ID>
       <wd:ID wd:type="Worker_Type_ID">EE</wd:ID>
    </wd:Worker_Type>

XSLT中用于获取描述符值的代码

                <xsl:for-each select= "*:Worker_Type">  
                    <xsl:element name="Worker_Type1">
                            <xsl:value-of select="@Descriptor"/>
                    </xsl:element>
                </xsl:for-each>

但我没有得到输出中的值,也没有错误

1 个答案:

答案 0 :(得分:0)

由于您尚未指定前缀,您可以尝试以下操作:

<xsl:value-of select="@*:Descriptor"/>

或者,如果前缀例如是样式表中命名空间的wd,那么您也可以使用它:

<xsl:value-of select="@wd:Descriptor"/>
相关问题