Here’s one approach:
<xsl:function name="f:element-matches" as="xs:boolean">
<xsl:param name="srcElement" as="element()"/>
<xsl:param name="targetElem" as="element()"/>
<xsl:choose>
<xsl:when test="node-name($srcElement) = node-name($targetElem)">
<xsl:variable name="attrMatch">
<xsl:for-each select="$srcElement/@*[namespace-uri(.) = '']">
<xsl:variable name="aname" select="local-name(.)"/>
<xsl:variable name="attr" select="$targetElem/@*[local-name(.) = $aname]"/>
<xsl:choose>
<xsl:when test="$attr = .">1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="not(contains($attrMatch, '0'))"/>
</xsl:when>
<xsl:otherwise><xsl:value-of select="false()"/></xsl:otherwise>
</xsl:choose>
</xsl:function>