Q:

XPath Predicate "is parent the current node?" 

I have a node set and I'd like to use a predicate to select from it only those nodes which have a template's current node as their parent. 
I'm using XSL 1.0 and msxsl. 
In the following non-working code, the predicate [parent::current()] does not work as I want it to as current() is not a valid NodeTest:
<? xml version="1.0" encoding="UTF-8" ? >
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />

    <xsl:variable name="set" select="//node[@attr1 = 'bbb']"/>

    <xsl:template name="TemplateA">
        <xsl:for-each select="$set[parent::current()]">
            <result-node>
                <xsl:value-of select="@value"/>
                <xsl:text>A</xsl:text>
            </result-node>
        </xsl:for-each>
    </xsl:template>

    <xsl:template name="TemplateB">
        <xsl:for-each select="$set[parent::current()]">
            <result-node>
                <xsl:value-of select="@value"/>
                <xsl:text>B</xsl:text>
            </result-node>
        </xsl:for-each>
    </xsl:template>

    <xsl:template match="/body">
        <result>
        <xsl:for-each select="parentNode">
            <xsl:call-template name="TemplateA" />
            <xsl:call-template name="TemplateB" />
        </xsl:for-each>
        </result>
    </xsl:template>

</xsl:transform>

Here is a sample XML to feed the above:
<? xml version="1.0" encoding="UTF-8"? >
<body>
    <parentNode>
        <node attr1="aaa" value="1" />
        <node attr1="bbb" value="2" />
    </parentNode>

    <parentNode>
        <node attr1="aaa" value="3" />
        <node attr1="bbb" value="4" />
    </parentNode>
</body>

Here is the desired output:
<result>
    <result-node>2A</result-node>
    <result-node>2B</result-node>
    <result-node>4A</result-node>
    <result-node>4B</result-node>
</result>

The above example can also be found here: http://xsltransform.net/jyH9rMg

A:

The way to compare nodes for identity in XSLT 1.0 is to use generate-id():
<xsl:for-each select="$set[generate-id(..) = generate-id(current())]">

.. is a shorthand for parent::node() and refers to the parent of the context node (the node being tested by this execution of the predicate).