Copied to clipboard

Flag this post as spam?

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


  • David Conlisk 432 posts 1008 karma points
    May 19, 2010 @ 15:55
    David Conlisk
    0

    4.1 beta 2 - XPATH for parent node id does not work

    Hi Ron,

    I'm developing a multilingual site using Umbraco 4.1 beta 2. I'm using Ultimate pickers on the prototype site but I realise that this is going to cause me problems when I copy the site to create multiple languages. Obviously the Ultimate pickers will need to point to nodes in their own site, and not back to the prototype site! Anyway, that's why this package is perfect, I can use it to find my picker items using relative paths from the current node. Ideal.

    However, when I install it on Umbraco v4.1 beta 2 no XPATH queries work for specifying the parent node id. If I enter the current node's ID, then it works as expected and I can choose from the child nodes of the current node. However, if I enter $currentPage, the picker simply displays nothing.

    I'm not sure if this is to do with the new XML format in v4.1 but I would have thought that $currentPage would work anyway. Do you have any plans to test this package in v4.1?

    Thanks and keep up the good work.

    David

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    May 19, 2010 @ 16:05
    Douglas Robar
    0

    For a quick work-around, you can use the old ('legacy') xml schema in 4.1 as well. Just change the setting in the umbracoSettings.config file.

    cheers,
    doug.

  • David Conlisk 432 posts 1008 karma points
    May 20, 2010 @ 12:27
    David Conlisk
    0

    Thanks Doug. I'm developing a site for 4.1 at the moment so I am creating my xslt macros to use the new schema (which is great, not sorry to see the back of data[@alias = 'bla'] everywhere that's for sure).

    I'm hanging in for an upgrade to the project for 4.1 :) If required I'll see if I can have a look at it myself...

  • KsuValk 32 posts 52 karma points
    Aug 01, 2010 @ 03:03
    KsuValk
    0

    Any update on this working for the new xml schema?  I too am doing a new scheme site (v4.5.1) and this is a perfect solution if we can just get it working for the new schema!

     

  • KsuValk 32 posts 52 karma points
    Aug 01, 2010 @ 03:11
    KsuValk
    0

    Is this the only code that needs to be modifed to get this working?  In getParentNodeIdFromXPath?  Ideally I guess an update would determine what version of umbraco is being used and adjust accordingly (like look at the useLegacyXml appsetting or whatever it is that is only present in 4.1 and higher).

    I wish my xslt was better!

                    XPathNavigator navigator = content.Instance.XmlContent.CreateNavigator();
                    string Expression =
                        xpath.Replace("$currentPage", "//node[@id='" + currentNodeId + "']").Replace("$currentParent",
                                                                                                     currentNodeParent ==
                                                                                                     null
                                                                                                         ? "/root"
                                                                                                         : "//node[@id='" +
                                                                                                           currentNodeParent
                                                                                                               .Id + "']");
     

  • KsuValk 32 posts 52 karma points
    Aug 02, 2010 @ 01:29
    KsuValk
    0

    I tried this but doesn't seem to work :(

     

     

     

     

    string

    Expression =

    xpath.Replace(

     

     

    "$currentPage", String.Format("umbraco.library:GetXmlNodeById({0})"

    , currentNodeId))

    .Replace(

     

     

    "$currentParent", currentNodeParent ==

    null

    ?

     

     

    "/root" : String.Format("umbraco.library:GetXmlNodeById({0})"

    , currentNodeParent.Id));

  • KsuValk 32 posts 52 karma points
    Aug 03, 2010 @ 02:19
    KsuValk
    0

    Here's my latest attempt, but when I place a dropdownlist of this type in a doc type (right along with an Ultimate Picker to test both) and use an XPath in the Axendo, viewing the content (published) shows nothing, not even an empty dropdownlist:

     

     

     

     

     

    XPathNavigator navigator = content

    .Instance.XmlContent.CreateNavigator();

     

    string

    Expression =

    xpath.Replace(

     

     

    "$currentPage", String.Format("//*[@isDoc][@id = {0}]"

    , currentNodeId))

    .Replace(

     

     

    "$currentParent", currentNodeParent ==

    null

    ?

     

     

    "/root" : String.Format("//*[@isDoc][@id = {0}]"

    , currentNodeParent.Id));

Please Sign in or register to post replies

Write your reply to:

Draft