Hi everybody,
I'm creating a filter that needs to join diffenrent filtering results. But I have a problem assigning variables in XSLT, which are node-sets.
Her is my code:
Code: <!-- Filters the source for Categories -->
<xsl:variable name="categoryFilteredSource">
<xsl:if test="$FilterCategory != ''">
<xsl:value-of select="$source[umbraco.library:LastIndexOf(data [@alias='Categories'], $FilterCategory) != '-1']"/>
</xsl:if>
</xsl:variable>
kat: <xsl:value-of select="msxml:node-set($categoryFilteredSource)"/><br/>
<xsl:value-of select="count($source[umbraco.library:LastIndexOf(data [@alias='Categories'], $FilterCategory) != '-1'])"/> <!-- Does return the correct value -->
katCount: <xsl:value-of select="count(msxml:node-set($categoryFilteredSource))"/><br/> <!-- Does not return the correct value. Always returns 1 -->
<xsl:for-each select="msxml:node-set($categoryFilteredSource)">
<xsl:value-of select="./@nodeName"/>
</xsl:for-each>
So what happens is this: When assigning the $categoryFilteredSource I only want it to contain a value if the $FilterCategory variable is set. This does seem to work, because hen printing the contents of the $categoryFilteredSource variable it doesn't seem to have any contents, when $FilterCategory is '' and does have contents when $FilterCategory is set.
The wierd part is that regardless if the $FilterCategory varibel is set or not, the count of the $categoryFilteredSource variable is 1.
And it is not possible to iterate over the $categoryFilteredSource contents in any situation.
Can anybody help as I'm goig nuts over this issue...
Thanks a lot in advance :o)
/Kim