.. which is ok.. but it grabs ALL of the SDProfiles created in my site.. and thats NOT what I want. I only want to check my parent node and grab all of the children under that 1 parent.
"SDProfile" is the doctype that I want to pull... so here is a graphic to help illustrate my issue and node tree...
What version of Umbraco are you using? The below snippet assumes that it's at least version 4.5.x
You actually don't need to call the GetXmlAll() extension at all.
In the macro you're using on the "Doctoral Students" you should be able to simply write (From the top of my mind, it's been a while since I coded XSLT :-/)
<xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc and @level ='1'/descendant::SDProfile]">
So what this should do is go to the node at level 1 (The Student Directory node) and then it should find every descendant of with the SDProfile alias.
It might be a good idea to write it out in a textarea to make sure any nodes are returned at all like
<textarea>
<xsl:copy-of select="$currentPage/ancestor-or-self::*[@isDoc and @level ='1'/descendant::SDProfile]" />
</textarea>
A nice tool to use in order to visualize, which nodes are selected using the different axes is available here http://pimpmyxslt.com/axesviz.aspx - Credits to @greystate aka Chriztian "XSLT" Steinmeier :)
Also it might be handy to look at the XML structure in the /App_Data/umbraco.config file.
Thanks for the suggestion..I'm currently using v4.8
I tried your code and it just through back an error. :-( "Error occured
System.Xml.Xsl.XslLoadException: Expression must evaluate to a node-set. ...r-or-self::*[@isDoc and @level = -->'1'<-- /descendant::SDProfile] An error occurred at D:\Inetpub\wwwroot\Umbraco\xslt\635579715280572925_temp.xslt(24,7). at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver) at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)"
Technically I think the student Directory Node is like level 3 in my full site tree..
I have been able to get a few others to "kind of work"... but I'm still basically writing the same thing where it's calling ALL of the SDProfiles and not just the ones inside my immediate parent:
Get All Children From Parent Node with Specific DocType
So right now I am using:
.. which is ok.. but it grabs ALL of the SDProfiles created in my site.. and thats NOT what I want. I only want to check my parent node and grab all of the children under that 1 parent.
"SDProfile" is the doctype that I want to pull... so here is a graphic to help illustrate my issue and node tree...
Thanks in advance for your help!
Hi FarmFreshCode
What version of Umbraco are you using? The below snippet assumes that it's at least version 4.5.x
You actually don't need to call the GetXmlAll() extension at all.
In the macro you're using on the "Doctoral Students" you should be able to simply write (From the top of my mind, it's been a while since I coded XSLT :-/)
So what this should do is go to the node at level 1 (The Student Directory node) and then it should find every descendant of with the SDProfile alias.
It might be a good idea to write it out in a textarea to make sure any nodes are returned at all like
A nice tool to use in order to visualize, which nodes are selected using the different axes is available here http://pimpmyxslt.com/axesviz.aspx - Credits to @greystate aka Chriztian "XSLT" Steinmeier :)
Also it might be handy to look at the XML structure in the /App_Data/umbraco.config file.
Hope this makes sense!
/Jan
Hi Jan,
Thanks for the suggestion..I'm currently using v4.8
I tried your code and it just through back an error. :-(
"Error occured
System.Xml.Xsl.XslLoadException: Expression must evaluate to a node-set.
...r-or-self::*[@isDoc and @level = -->'1'<-- /descendant::SDProfile] An error occurred at D:\Inetpub\wwwroot\Umbraco\xslt\635579715280572925_temp.xslt(24,7).
at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)"
Technically I think the student Directory Node is like level 3 in my full site tree..
I have been able to get a few others to "kind of work"... but I'm still basically writing the same thing where it's calling ALL of the SDProfiles and not just the ones inside my immediate parent:
<xsl:for-each select="$currentPage/ancestor::root//SDProfile ">
<xsl:for-each select="$currentPage/ancestor::*[@isDoc]//SDProfile ">
Those 2 seem to give me the same result as:
Hi FarmFreshCode
Hmm, yeah...I have a typo in my code snippet. It should read
I think you should give it a spin again since there can be some performance issues with using the // trick that you're using above as far as I know.
/Jan
THANKS JAN!
I made just a few tweaks to it and now it looks like it's working great:
* I changed it back to a "for-each" statement and changed the @level to 3 and that seemed to do it!
is working on a reply...