user3894628
user3894628

Reputation:

Getting the value of a parent node element in XSL

Unfortunately the xsl outputs the same ShortName entry for each section with this construct:

<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>

The XML:

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

Thanks

Upvotes: 0

Views: 25

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167716

It seems instead of the path //ShortName you want ancestor::Item/ShortName.

Upvotes: 1

Related Questions