在XSL中获取父节点元素的值

时间:2018-03-10 10:37:31

标签: xslt

不幸的是,xsl为每个具有此结构的部分输出相同的ShortName条目:

<xsl:for-each select="Questionnaire/Section">
<xsl:for-each select="Item">
<xsl:value-of select="Question"/></strong>
<xsl:for-each select="Optionlist/option">       
<input type="radio" > 
<xsl:attribute name="name"><xsl:value-of select="//ShortName" />
</xsl:attribute>

XML:

<Questionnaire>
<Section><Title>Available Data</Title>
<Item>
<ShortName>Name</ShortName>
<Optionlist>
<option><entry>Yes</entry></option></Optionlist>
</Item>
</Section>

由于     

1 个答案:

答案 0 :(得分:1)

似乎不是您想要//ShortName的路径ancestor::Item/ShortName

相关问题