Check if variable contains "currentPage"

Hello guys,

I'm trying to make a condition, where the code only runs if a variable contains the currentPage..
I'm passing the $source page, to get all of its children...
here's the code:

<xsl:variable name="items" select="umbraco.library:GetXmlNodeById($source)/descendant::*  [@isDoc and string(umbracoNaviHide) != '1']"  />

<xsl:if test="contains($items, $currentPage)">

   <xsl:for-each select="$items">

      'do something'

    </xsl:for-each>

</xsl:if>

If I choose the first page that is contained in "$items", the code is triggered, but if I go to the 2nd or 3rd page in $items, the code is not triggered


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/61515-check-if-variable-contains-currentpage