【发布时间】:2012-11-12 04:00:49
【问题描述】:
目前我有一些这样的 xml 结构:
<element type="Input" name="nationality">
<property i18n="true" text="Nationality" prefix="person.nationality."
name="caption">caption</property>
<property i18n="true" text="Nationality" prefix="person.nationality."
name="desc">desc</property>
<property name="visible">1</property>
<property name="mandatory">0</property>
<property name="value">AUS</property>
<restriction prefix="country." base="String">
<enumeration text="Albania" value="ALB" />
<enumeration text="Algeria" value="DZA" />
<enumeration text="Argentina" value="ARG" />
<enumeration text="Australia" value="AUS" />
<enumeration text="Austria" value="AUT" />
<enumeration text="Bahrain" value="BHR" />
</restriction>
</element>
我想问有没有什么方法可以使用 xpath 来提取枚举[@text] 标记的值,其值等于属性中的文本 [@name='value']。在这种情况下,期望文本“澳大利亚”。
这只是我第一次使用 xpath,任何想法将不胜感激。谢谢大家。
【问题讨论】:
标签: xml xslt xpath parent-child siblings