Copied to clipboard

Flag this post as spam?

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


  • bayshield 50 posts 65 karma points
    Aug 21, 2009 @ 09:06
    bayshield
    0

    Getting NodeID from DocType and DocName using XSLT and API

    Hi,

    I am trying to find the nodeID for a document so I can create a child document under it.

    The XSLT I am using is as follows (where 'McIntyre' is the name of the parent page)

    "node[@nodeName='McIntyre' and @nodeTypeAlias='Family']" 

    I am then calling the XSLT with the following code

     System.Xml.XPath.XPathNodeIterator iter = umbraco.library.GetXmlNodeByXPath(itemName);

    I am having trouble debugging the solution and no matter what I do with the iterator can't seem to get to the NodeID.  

    I am definately not an XSLT guru and would appreciate any help.

     

    Thanks

    Aaron

     

  • Chris Koiak 700 posts 2626 karma points
    Aug 21, 2009 @ 13:41
    Chris Koiak
    101

    Try

     System.Xml.XPath.XPathNodeIterator iter = umbraco.library.GetXmlNodeByXPath("//node[@nodeName='McIntyre' and @nodeTypeAlias='Family']" );
  • bayshield 50 posts 65 karma points
    Aug 21, 2009 @ 22:47
    bayshield
    0

    Thanks Chris.

    Adding the // to the front of the XSLT solved the problem.  I had been using an online tester which had been working without the // which is what threw me.

     

    Cheers

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies