Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • jeb 50 posts 20 karma points
    Feb 12, 2009 @ 16:36
    jeb
    0

    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.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Feb 12, 2009 @ 16:43
    Dave Woestenborghs
    0

    [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]

  • jeb 50 posts 20 karma points
    Feb 12, 2009 @ 17:36
    jeb
    0

    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.



  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 12, 2009 @ 17:54
    Dirk De Grave
    0

    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

  • jeb 50 posts 20 karma points
    Feb 12, 2009 @ 18:58
    jeb
    0

    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.

  • jeb 50 posts 20 karma points
    Feb 12, 2009 @ 21:47
    jeb
    0

    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.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 12, 2009 @ 22:38
    Dirk De Grave
    0

    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


  • jeb 50 posts 20 karma points
    Feb 13, 2009 @ 19:57
    jeb
    0

    Thanks, Dirk. That's cheating. But I like it.

    Jeb.

Please Sign in or register to post replies

Write your reply to:

Draft