|
|
Rank: Newbie
Joined: 3/25/2008 Posts: 11
|
Hi,
I have a site-structure like this -frontpage --subpage 1 --subpage 2
Im creating a menu doing something like this <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']">
If level = 1, I get the expected...subpage 1 and 2 If level = 0, I get nothing?
What am I doing wrong?
|
|
 Rank: Fanatic
Joined: 9/27/2007 Posts: 465 Location: Belgium
|
Quote:What am I doing wrong? In fact, nothing. Frontpage will get level = 1 and there will not be a node at level = 0. Have a look at your db if you can, and exec this query Code:SELECT [nodeId], [xml] FROM [dbo].[cmsContentXml] Regards, /Dirk
level 1 certified - umbraco blog at netaddicts.be
|
|
Rank: Newbie
Joined: 7/5/2007 Posts: 21
|
Hi, As recommended on another post, I found SketchPath 2.0 in conjunction with an XML dump of the Umbraco content to be really helpful for understanding and checking the XSLT. To get the XML I use a 'debug' macro which just returns : Code: <xsl:copy-of select="umbraco.library:GetXmlAll()" />
Although I believe the Umbraco.config file in the \data folder contains the same information. To get all nodes at -fontpage level, it's just : and to get them via the $currrentPage parameter it's : Code: $currentPage/ancestor::root/node
HTH, Hendy.
|
|
Rank: Newbie
Joined: 3/25/2008 Posts: 11
|
Thanks for replies :)
Im not sure I ended up with the best solution, but I just did two for-each
Frontpage <xsl:for-each select="$currentPage/ancestor-or-self::root/node [string(data [@alias='umbracoNaviHide']) != '1']">
All others <xsl:for-each select="$currentPage/ancestor-or-self::node[@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']">
Not that good looking, but it works :)
|
|
Rank: Newbie
Joined: 5/30/2008 Posts: 1 Location: UK
|
Good to see SketchPath is being found helpful. Just a quick tip: When you use: node != 'b' in XPath its unlikely that this will give you want you want in all cases. This is down to the 'existential quantifier' in XPath. If you're looking to achieve the opposite of node = 'b' , use not(node = 'b') instead. A fuller explantation is at: http://www.w3.org/XML/2003/11/xpath-xquery-issues/#xquery-xpath-existential
|
|
 Rank: Fanatic
Joined: 9/27/2007 Posts: 465 Location: Belgium
|
Oh yes pgfearo, your tool is a real timesaver for non-xslt guru's. Many thanks for sharing. I've 'sent' already a lot of people to your site to grab the tool. Again, thanks for the effort. Regards, /Dirk
level 1 certified - umbraco blog at netaddicts.be
|
|
|
Guest |