Q:

Getting the outer node based on the inner node value with XSLT XPATH

Im have the following XML:
<elements>
<a>
 <b>b1</b>
 <c>
  <d>d1</d>
 </c>
</a>
<a>
 <b>b2</b>
 <c>
  <d>d2</d>
 </c>
</a>
</elements>

I have an xslt template, where I try to get the first  content (in this case, b1) where its inner  content equals to something.
I tried:
<xsl:value-of select="elements/a[c/d = d1]/b" />

But it fails to work. I expect to get b1, yet I get nothing.

A:

You are missing quotes around the string d1:
<xsl:value-of select="elements/a[c/d = 'd1']/b" />

