Im currently attempting to learn XML, XSLT & XPATH to enhance my skills with umbraco. Im really keen to ensure that Im on the coorect lines when understanding what the sytax means. So I was wondering if someone could take the time to help me please?
Im currently looking at the 2ndlevel navigation xslt template and im trying to work out what the following line of code is doing. So I have the following code where the variable level is set to 2.
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
And this is my understanding $currentPage = From the current page that you are currently on /ancestor-or-self::* = including the current page that you are on also look at all (represented by ::*) the pages above this until you find the nodes which are at level 2 that are of type doc and the umbracoNaviHide property is not equal to true (represented by !='1') /* after the level predicate = once all of the matches have been made then display all child nodes (which will be all level 3 nodes) of the level 2 node (represented by /*)
Please tell me im on the correct lines my brains are racking ha. Hope my explination makes clear writing.
Yes, you're pretty much spot on - the only difference is that the check for the umbracoNaviHide property is on the level 3 nodes (not the level 2). Other than that, you've got it! :-)
Thanks for the response mate! Much appreciated. This xml, xslt and xpath can be quite daunting to begin with so im just making sure that im understanding the basics properly before getting ahead of myself!
Going to try and find some good resources that clearly outline the syntax meaning for xpath to help me
Once again mate thanks for the help! Ill be sure to check out the resources that you have provided ;). That is exactly the kind of help and stuff I will need in order to help me with my quest in trying to master xml, xslt & xpath ;)
XSLT Explination
Hello everyone!
Im currently attempting to learn XML, XSLT & XPATH to enhance my skills with umbraco. Im really keen to ensure that Im on the coorect lines when understanding what the sytax means. So I was wondering if someone could take the time to help me please?
Im currently looking at the 2ndlevel navigation xslt template and im trying to work out what the following line of code is doing. So I have the following code where the variable level is set to 2.
And this is my understanding
$currentPage = From the current page that you are currently on
/ancestor-or-self::* = including the current page that you are on also look at all (represented by ::*) the pages above this until you find the nodes which are at level 2 that are of type doc and the umbracoNaviHide property is not equal to true (represented by !='1')
/* after the level predicate = once all of the matches have been made then display all child nodes (which will be all level 3 nodes) of the level 2 node (represented by /*)
Please tell me im on the correct lines my brains are racking ha. Hope my explination makes clear writing.
Thanks for any help in advance
Paul
Hi Paul,
Yes, you're pretty much spot on - the only difference is that the check for the
umbracoNaviHide
property is on the level 3 nodes (not the level 2). Other than that, you've got it! :-)Cheers, Lee
Hi Lee
Thanks for the response mate! Much appreciated. This xml, xslt and xpath can be quite daunting to begin with so im just making sure that im understanding the basics properly before getting ahead of myself!
Going to try and find some good resources that clearly outline the syntax meaning for xpath to help me
Cheers
Paul
If you haven't seen it already, take a look at the XPath Axes Visualizer (by Chriztian Steinmeier)
http://pimpmyxslt.com/axesviz.aspx
... and his Pimp My XSLT has a range of articles:
http://pimpmyxslt.com/articles/
Cheers, Lee.
Hey Lee,
Once again mate thanks for the help! Ill be sure to check out the resources that you have provided ;). That is exactly the kind of help and stuff I will need in order to help me with my quest in trying to master xml, xslt & xpath ;)
Nice 1
Paul
is working on a reply...