Reputation: 389
I am trying to get a the value <abc-value>abc</abc-value>
of other child node elment from current node.
Example:
<root>
<child1>
<abc-value>abc</abc-value>
</child>
<child2>
<attribute name=def>def</def-value>
</child2>
</root>
XSL:
<xsl:template name="child2" match="attribute">
child1 value is: <xsl:value-of select="../abc-value"/>
child2 value is: <xsl:value-of select="current()"/>
</xsl:template>
All i am trying to do is, from child2 template match, I am calling the value of child1 element <abc-value>abc</abc-value>
.
Exptected out:
Child1 value is: abc
Child2 value is: def
Upvotes: 0
Views: 2887
Reputation: 27996
<xsl:template name="child2" match="attribute">
child1 value is: <xsl:value-of select="../../child1/abc-value" />
child2 value is: <xsl:value-of select="." />
</xsl:template>
Update: based on the edit to your question:
<attribute>
element.<attribute>
element) is deeper than before, the select expression for the child1 value is changed to use an additional ../
.Upvotes: 3