获取 XML 中的属性值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5489536/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 14:37:44 来源:igfitidea点击:
Getting the value of an attribute in XML
提问by Dallas
How would one get the value of attribute1 (blah) in the following xml using xslt:
如何使用 xslt 在以下 xml 中获取 attribute1 (blah) 的值:
<name attribute1="blah" attribute2="blahblah">
</name>
回答by James Sulak
This is more of an xpath question, but like this, assuming the context is the parent element:
这更像是一个 xpath 问题,但像这样,假设上下文是父元素:
<xsl:value-of select="name/@attribute1" />

![找不到类路径资源 [bean.xml] 中定义的名为“helloworld”的 bean 的类 [com.springdemo]](/res/img/loading.gif)