Firstly...great package! I've used it in many sites and love it.
However, in the latest site I'm creating, I want to have standard values being pulled from a parent content node...which I assume you can do by creating a XPath key. But I can't figure out how to reference the 'parent' as there is no current page.
Note that I can't use the Node key type to hard code the parent as the parent node may be different. Ie, my content tree looks like Companies > Company > Branch and I'm trying to make the Branch standard values pull from the Company node.
Is it possible? If so, can you please supply a sample XPath snippet for getting a property value from the parent?
I'm afraid that the XPath can only be used for somewhat static values, as you have to start from the root with something like: /root/node[@id='1048']/data Behind the scenes it's simple using "umbracoXml.SelectSingleNode(xpath).InnerText".
I have been thinking about adding some more flexibility with regards to getting values from parents and ancestors, as the current methods aren't as dynamic as I would have liked. But I never got around to it. But it should be a fairly simple task to implement. I will try to implement 'parent' and 'ancestor' as new types, so you simple need to create a new key and specify the property alias that contains the value you want to insert.
This functionality is still limited to inputting an XPath, which will be applied to the published content xml cache, but it still has no context of currentpage. So it won't be able to traverse up and down like you are used to in xslt. I could probably add the Id of the current page by replacing a pre-defined key, but not sure if this will be sufficient for what you want to do ?
How to use XPath key?
Hey Morten,
Firstly...great package! I've used it in many sites and love it.
However, in the latest site I'm creating, I want to have standard values being pulled from a parent content node...which I assume you can do by creating a XPath key. But I can't figure out how to reference the 'parent' as there is no current page.
Note that I can't use the Node key type to hard code the parent as the parent node may be different. Ie, my content tree looks like Companies > Company > Branch and I'm trying to make the Branch standard values pull from the Company node.
Is it possible? If so, can you please supply a sample XPath snippet for getting a property value from the parent?
TIA, Trevor.
Hi Trevor,
I'm afraid that the XPath can only be used for somewhat static values, as you have to start from the root with something like:
/root/node[@id='1048']/data
Behind the scenes it's simple using "umbracoXml.SelectSingleNode(xpath).InnerText".
I have been thinking about adding some more flexibility with regards to getting values from parents and ancestors, as the current methods aren't as dynamic as I would have liked. But I never got around to it. But it should be a fairly simple task to implement.
I will try to implement 'parent' and 'ancestor' as new types, so you simple need to create a new key and specify the property alias that contains the value you want to insert.
I'll post back when its ready.
- Morten
That would be awesome.
Thanks, Trevor
@Morten, with that added functionality would you be able to traverse up the tree until you hit a parent node of specified doctype (like currentPage)?
Hi Dan,
Sorry for the late reply.
This functionality is still limited to inputting an XPath, which will be applied to the published content xml cache, but it still has no context of currentpage. So it won't be able to traverse up and down like you are used to in xslt.
I could probably add the Id of the current page by replacing a pre-defined key, but not sure if this will be sufficient for what you want to do ?
- Morten
Hello friends!. Found a solution to use XPath? and thus be able to traverse the nodes above and below the current one.
There is a documentation for the use of standard values?. Sorry friends is that I am new to this. Great package!, Many Thanks!
is working on a reply...