Copied to clipboard

Flag this post as spam?

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


  • Daniel Lindstrom 454 posts 271 karma points
    Jan 23, 2009 @ 09:39
    Daniel Lindstrom
    0

    Return node set from template (in another xslt file)

    Hi
    In XSLT file 1 I have a generic paging function that takes some parameters and finds the nodes to be displayed.

    In XSLT file 2 I'd like to inlude xslt file 1 with the paging function, call file the 1 template to retrieve the nodes and then work on them in file 2.

    Is that possible?

    I tried to do something like this (actual paging logic excluded, replaced with GetXMLAll()):

    In file 1:



    In file 2:




    But I get
    System.Xml.Xsl.XsltException: Expression must evaluate to a node-set
    on the for-each.

    Any suggestion, solutions or ideas for other approaches would be extremely appriciated!

    Thanks!

  • Daniel Lindstrom 454 posts 271 karma points
    Jan 23, 2009 @ 09:48
    Daniel Lindstrom
    0

    OK as I have discovered copy-of, I can now at least get the xml nodes as a string to the $nodes variable. Now I need to convert that string to a node set. I am sure I have seen this on the forum....

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Jan 23, 2009 @ 10:19
    Dirk De Grave
    0

    Hi daniel_l,

    Use node-set() function...
    More info available here: http://www.xml.com/pub/a/2003/07/16/nodeset.html or perform a search for node-set in this forum

    Regards,
    /Dirk

  • Daniel Lindstrom 454 posts 271 karma points
    Jan 23, 2009 @ 10:48
    Daniel Lindstrom
    0

    Yes I have tried the following



    and then it does not throw an error, but I still cannot seem to iterate the sub nodes.

  • Daniel Lindstrom 454 posts 271 karma points
    Jan 23, 2009 @ 10:52
    Daniel Lindstrom
    0

    Well, it did not work on the string returned from GetXMLAll, but it worked on the actual code I was going to use!

    In the template with the paging function I do something like this, and the node-set function works on the resulting string.



    Thanks a lot! :)

  • 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