The XPath expression is correct as far as VS2005 is concerned. I have tested it there against a refreshed umbraco.config.
[code]//data[@alias='sidebarRightContent'][/code]
This expression can be read as "find any or all data nodes with an alias of 'sidebarRightContent'. I happen to know that there will only be one of these.
I also know that it will not be a child of the current page.
I am assuming that my XPath expression has access to the whole of umbraco.config.
Does Umbraco insist on starting the path with $currentPage?
Am I making some wrong assumptions? I really want to do this "The Umbraco Way" if possible.
[quote]I am assuming that my XPath expression has access to the whole of umbraco.config.[/quote]
Don't think so, umbraco only sends in the part of the xml that is relevant to the current requested page, which is what $currentPage will hold as its value.
I only read half the book! In the half I read it says:
[quote]As mentioned on the previous page, the currentPage parameter is important for us in Umbraco. It is the complete XML document of the published site, and is how we reference the data stored in each document. By default, the context of the XML document is set to the requested page. [/quote]
I think this statement may be in need of review. It would appear that the complete XML of the published site is not available to an XSLT file that is executed in a page context. This is an important limitation, if true.
I'm going to start another thread where I'll ask how to access data that is not on the XML fragment available to a page.
Ok, the complete XML is available, but you can't start your search where you like, you have to navigate from currentPage:
[code][/code]
The XPath expression here says "From the current page, walk up the ancestor axis until you find the root node and then find all data nodes below the root that have their alias attribute set to 'sidebarRightContent'.
My XSLT Works in VS2005 But Not In Umbraco
The juicy bit:
[code]
[/code]
When run against umbraco.config in VS2005 it works. A bunch of html markup is produced. I think html is what I want.
When run in umbraco it does not work. The value-of statement is never called. It follows that the XPath expression must be somehow "wrong" in Umbraco.
(It also follows that the output method of "html" is not the problem.)
Am I missing something?
Thanks for any help with this,
Jeb.
[quote=jebbushell]The juicy bit:
[code]
[/code]
When run against umbraco.config in VS2005 it works. A bunch of html markup is produced. I think html is what I want.
When run in umbraco it does not work. The value-of statement is never called. It follows that the XPath expression must be somehow "wrong" in Umbraco.
(It also follows that the output method of "html" is not the problem.)
Am I missing something?
Thanks for any help with this,
Jeb.[/quote]
You haven't include what node you want to use.
[code]
[/code]
The XPath expression is correct as far as VS2005 is concerned. I have tested it there against a refreshed umbraco.config.
[code]//data[@alias='sidebarRightContent'][/code]
This expression can be read as "find any or all data nodes with an alias of 'sidebarRightContent'. I happen to know that there will only be one of these.
I also know that it will not be a child of the current page.
I am assuming that my XPath expression has access to the whole of umbraco.config.
Does Umbraco insist on starting the path with $currentPage?
Am I making some wrong assumptions? I really want to do this "The Umbraco Way" if possible.
Jeb.
Hi jeb,
[quote]I am assuming that my XPath expression has access to the whole of umbraco.config.[/quote]
Don't think so, umbraco only sends in the part of the xml that is relevant to the current requested page, which is what $currentPage will hold as its value.
If you need to get up higher in the hierarchy, have a look at the available axis's at http://umbraco.org/documentation/books/xslt-basics/xpath-axes-and-their-shortcuts
Hope this helps.
Regards,
/Dirk
I only read half the book! In the half I read it says:
[quote]As mentioned on the previous page, the currentPage parameter is important for us in Umbraco. It is the complete XML document of the published site, and is how we reference the data stored in each document. By default, the context of the XML document is set to the requested page. [/quote]
I think this statement may be in need of review. It would appear that the complete XML of the published site is not available to an XSLT file that is executed in a page context. This is an important limitation, if true.
I'm going to start another thread where I'll ask how to access data that is not on the XML fragment available to a page.
Thanks, Dirk.
Jeb.
Ok, the complete XML is available, but you can't start your search where you like, you have to navigate from currentPage:
[code][/code]
The XPath expression here says "From the current page, walk up the ancestor axis until you find the root node and then find all data nodes below the root that have their alias attribute set to 'sidebarRightContent'.
Thanks for your help.
Jeb.
Hi jebbushell,
[quote]Ok, the complete XML is available, but you can't start your search where you like, you have to navigate from currentPage[/quote]
Yes you can (Hmm, someone has said that before)...
[code]umbraco.library:GetXmlDocumentByNode(nodeId) [/code]
will return xml fragment from nodeId specified as parameter. So, you don't NEED to start from $currentPage, but you CAN.
In fact, umbraco.library has a bunch of other functions which are quite useful in the xslt's.
Hope this helps.
Regards,
/Dirk
Thanks, Dirk. That's cheating. But I like it.
Jeb.
is working on a reply...