Assuming that using this well-formed XML:
<root>
<a some_attr="AAA"/>
<b>
<c/>
</b>
<b>
<c/>
</b>
<b>
<c/>
</b>
<b>
<c>
<d/>
</c>
</b>
</root>
this stylesheet/template seems to find the attribute value
and output it to the screen when I look for the "d" element...
<?xml version='1.0'?>
<xsl:stylesheet xmlns

sl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="//d">
<xsl:for-each select="preceding::node()">
<h4><xsl:value-of select="attribute::*"/></h4>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>