Copied to clipboard

Flag this post as spam?

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


  • Antony Briggs 78 posts 103 karma points
    Sep 24, 2009 @ 11:21
    Antony Briggs
    0

    Xml document that xslt macros are run against

    Hi Guys,

    I tried to select a node with a particular id in an xslt macro by doing the following:

    <xsl:for-each select="//node [@id=1053]//node [string(data [@alias='umbracoNaviHide']) != '1']">

    But it didn't retrieve anything?

    So my question is, what is the source XML document that the macro XSLT files are 'transforming'?

     

    PS. the original problem is fixed by using the following:

    <xsl:for-each select="$currentPage/ancestor::root//node [@id=1053]//node [string(data [@alias='umbracoNaviHide']) != '1']">

     

  • Ron Brouwer 273 posts 768 karma points
    Sep 24, 2009 @ 11:27
    Ron Brouwer
    0

    check: data/umbraco.config

    Ron

  • dandrayne 1138 posts 2262 karma points
    Sep 24, 2009 @ 11:27
    dandrayne
    0

    AFAIK you need to give it context, which comes from $currentPage.  I'd be interested to see if your method would be possible though.

    You could useGetXmlAll, or GetXmlDocumentById(1053), or traverse up the tree from currentPage and back down again. (the latter option reduces database calls, apparently)

    <xsl:for-each select="umbraco.library:GetXmlAll()//node [@id=1053]//node [string(data [@alias='umbracoNaviHide']) != '1']">

    <xsl:for-each select="
    umbraco.library:GetXmlDocumentById(1053)//node">
  • Antony Briggs 78 posts 103 karma points
    Sep 24, 2009 @ 11:53
    Antony Briggs
    0

    Ron: Yes that is what I was expecting, but is not the case apparenty. I'll have a dig in the code someday but for now I was just suprised that it didn't work that way.

    Dan: GetXmlAll doesn't make a database call, but i does create another xml navigator which may be memory heavy (I need to do some profiling on this .net XML stuff I've got a handful of live sites running on Umbraco now and I do get some memory spikes on my server every now and then. Although I removed the biggest memory hog - ImageGen.)

     

     

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Sep 24, 2009 @ 12:12
    Douglas Robar
    0

    Off topic, but as you mentioned it... there's a patch for ImageGen that addresses your issue. You can get it from http://our.umbraco.org/projects/imagegen

    cheers,
    doug.

  • Ron Brouwer 273 posts 768 karma points
    Sep 24, 2009 @ 13:08
    Ron Brouwer
    0

    I think I know what your problem is.

    Can it be that the node you are looking for is located outside your website in the content tree?
    When an node is outside the website it is not loaded into the xml.

    To resolve this use umbraco.library:GetXmlNodeById(1053)

    Ron

  • Sjors Pals 617 posts 270 karma points
    Sep 24, 2009 @ 17:47
    Sjors Pals
    0

    I think Ron's way is also nicer, especially when you use a parameter for the Rootnode, a way to see what you get back is to use the <xsl:copy-of> tag.

Please Sign in or register to post replies

Write your reply to:

Draft