Am i using the wrong syntax for checking the nodetypealias here? It doesnt seem to work. Always returns 'no' for every item even though i know for a fact some of the are using the news item document type.
Hi Bas Ive tried this but the node still says 'no'. so i then tried name(.) at a guess, this didnt work either. If i wanted to exclude a certain document type within my foreach line would it be this:
<xsl:for-each select="$currentPage/* [@isDoc and name() = 'newsItem']"> ?? this didnt work.
check if item in loop is news item
Am i using the wrong syntax for checking the nodetypealias here? It doesnt seem to work. Always returns 'no' for every item even though i know for a fact some of the are using the news item document type.
<xsl:for-each select="$currentPage/* [@isDoc]">
<xsl:choose>
<xsl:when test="./@nodeTypeAlias = 'newsItem'">
yes
</xsl:when>
<xsl:otherwise> no </xsl:otherwise>
</xsl:choose>
Hi Phil,
You have to use "name($currentPage)"
More info: http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/no-more-@nodetypealias
Cheers,
Bas
Hi Bas Ive tried this but the node still says 'no'. so i then tried name(.) at a guess, this didnt work either. If i wanted to exclude a certain document type within my foreach line would it be this:
<xsl:for-each select="$currentPage/* [@isDoc and name() = 'newsItem']"> ?? this didnt work.
Hi Phil,
Use the self:: axis to test the name when you know it:
<xsl:for-each select="$currentPage/*[@isDoc]"> <xsl:choose> <xsl:when test="self::newsItem"> yes </xsl:when> <xsl:otherwise> no </xsl:otherwise> </xsl:choose> </xsl:for-each>
If you only want to do something to newsItem documents:
<xsl:for-each select="$currentPage/newsItem"> <xsl:value-of select="@nodeName" /> </xsl:for-each>
/Chriztian
is working on a reply...