【问题标题】:Getting the value of an attribute in XML获取 XML 中属性的值
【发布时间】:2011-07-26 06:17:21
【问题描述】:

如何使用 xslt 在以下 xml 中获取属性 1 (blah) 的值:

<name attribute1="blah" attribute2="blahblah">
</name>

【问题讨论】:

    标签: xml xslt xpath attributes


    【解决方案1】:

    这更像是一个 xpath 问题,但是像这样,假设上下文是父元素:

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

    【讨论】:

    • 如果上下文不在父元素中怎么办?
    • 再次,这将是一个 xpath 问题;
    • @Arty - 我认为您正在寻找的只是 xsl:value-of select="./@attributename"
    • @SidharthRamesh 谢谢!这对我有用!
    猜你喜欢
    • 2016-11-05
    • 1970-01-01
    • 2012-02-28
    • 2016-08-01
    • 1970-01-01
    • 2011-05-07
    • 1970-01-01
    • 1970-01-01
    • 2023-03-13
    相关资源
    最近更新 更多