Correct syntax for checking two attributes in a for-each-statement Options
electricric
Posted: Wednesday, August 27, 2008 11:29:02 AM
Rank: Newbie

Joined: 8/25/2008
Posts: 16
Location: Germany
Hi,

i have a fairly simple question concerning the XSLT-Syntax:

I want to check my nodes for two attributes, the "@nodeTypeAlias" and "umbracoNaviHide".
I thought of something like the following code, but obviously the "&" doesn't work out ( i tried some other variants, too) and i don't know how to write it correctly:

Code:

<xsl:for-each select="$currentPage/ancestor::root/descendant-or-self::node[@nodeTypeAlias = 'MainContent'] & [string(data [@alias='umbracoNaviHide']) != '1']">



Can someone please give me the right code for this?

And Is there a shorter way to select the root node or is the $currentPage neccessary in Umbraco?


Greetings,

Electric-Ric
Dirk
Posted: Wednesday, August 27, 2008 11:56:14 AM

Rank: Addict

Joined: 9/27/2007
Posts: 977
Location: Belgium
Hi,

Replace your '&' by 'and'.

Regards,
/Dirk




level 1 certified - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
electricric
Posted: Wednesday, August 27, 2008 12:01:30 PM
Rank: Newbie

Joined: 8/25/2008
Posts: 16
Location: Germany

Thanks Dirk!

the working code now looks like this:

Code:

<xsl:for-each select="$currentPage/ancestor::root/descendant-or-self::node[@nodeTypeAlias = 'MainContent' and string(data [@alias='umbracoNaviHide']) != '1'] ">



Greetings,

Electric-Ric
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.