Ony one of my XSLT macros, I need to get content from another page. For example, lets say I'm on the support page and want to display a list of products from the Products page. currentPage only has support page data, how do I grab the nodes from products?
<xsl:variable name="source" select="umbraco.library:GetXmlNodeById('THE ID OF THE PRODUCTS NODE')"/> <xsl:value-of select="$source/@nodeName"/> //nodeName of the "source"
<xsl:for-each select="$source/* [@isDoc]"> //list of children of the "source" <xsl:value-of select="@nodeName"/><br/> </xsl:for-each>
The source variable can replace your $currentPage param. Hope this helps :)
Yes, just to clarify I have 2 sites that have the same basic structure but different NodeId's. I copy data back and forth between them so it's important to use the path instead of the ID.
I have /Content/Products which has a list of products underneath it. I'm currently on the /Content/Support page and need to get that list of products. It's not in the currentPage variable, I tried variations of /root/products but couldn't quite figure it out.
I think I know what you want to achieve. The product-node, does this have a unique document type, or can we be sure that the node name will never change?
Content from another page
Ony one of my XSLT macros, I need to get content from another page. For example, lets say I'm on the support page and want to display a list of products from the Products page. currentPage only has support page data, how do I grab the nodes from products?
Hi Chris,
I think the XSLT your are looking for is:
The source variable can replace your $currentPage param. Hope this helps :)
Else I can recommend the umbraco tv guides..
/Peter
Hi Chris
As you wrote in another post you don't want to use the GetXmlNodeById, but find the nodes with xpath.
Could you show us your content structure inside Umbraco? Then we'll be able to help you out with the correct xpath :)
/Kim A
Hi Kim,
Yes, just to clarify I have 2 sites that have the same basic structure but different NodeId's. I copy data back and forth between them so it's important to use the path instead of the ID.
I have /Content/Products which has a list of products underneath it. I'm currently on the /Content/Support page and need to get that list of products. It's not in the currentPage variable, I tried variations of /root/products but couldn't quite figure it out.
Thanks!
I think I know what you want to achieve. The product-node, does this have a unique document type, or can we be sure that the node name will never change?
/Kim A
The node name will never change, but they also use separate document types - Products vs Support.
Okay you can try this:
This should run through the childnodes under the Products-node, if the alias of the document type is "Products".
Does this work?
/Kim A
Hi Kim,
Worked perfect, thank you. I there any way to do it based on the root? Some of the items underneath support may use it as well.
Thank you very much for your help!
If I knew how your total structure looked like I could tell you for sure.
But something like this should work:
If your homepage is on level 1, and the Products-node is on the next level the above code should work.
/Kim A
Hi Kim,
That's returning blank. I've attached an image that shows the basic structure.
Ahh okay, try this instead:
/Kim A
is working on a reply...