Copied to clipboard

Flag this post as spam?

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


  • Peter Drayton 29 posts 49 karma points
    Dec 13, 2011 @ 12:25
    Peter Drayton
    0

    New Scheme xslt Example

    Following the examples in XSLT Examples updated to New Schema

    Why doesn't this work?

     

    <xsl:for-each select="umbraco.library:GetXmlNodeById(1064)/*[not(self::DateFolder)]">
    </xsl:for-each>

     

     

  • Peter Drayton 29 posts 49 karma points
    Dec 13, 2011 @ 12:51
    Peter Drayton
    0

    Unless someone else knows of a different way to select ALL nodes under a certain node where it is NOT a DateFolder?

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Dec 13, 2011 @ 13:12
    Chriztian Steinmeier
    0

    Hi Peter,

    The XPath shown will select all direct children of the '1064' node - which also includes the properties of that node; It's very likely that the stuff you do inside the loop is counting on the nodes to be Umbraco Document nodes, so you need to add the @isDoc predicate, to filter out the property elements:

    <xsl:for-each select="umbraco.library:GetXmlNodeById(1064)/*[@isDoc][not(self::DateFolder)]">
    ...
    </xsl:for-each>

    If you're not only after the direct children, but also their children (and so on), go for the descendant:: axis instead, which can be abbreviated as a double-slash:

    <xsl:for-each select="umbraco.library:GetXmlNodeById(1064)//*[@isDoc][not(self::DateFolder)]">
    ...
    </xsl:for-each>

    /Chriztian

  • Peter Drayton 29 posts 49 karma points
    Dec 13, 2011 @ 13:14
    Peter Drayton
    0

    Cheers Chriztian, you're a star!

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Dec 13, 2011 @ 13:22
    Chriztian Steinmeier
    0

    No worries, Peter :-)

    - I've corrected the error on the Wiki Page too - thanks for pointing that out! 

    /Chriztian

  • Peter Drayton 29 posts 49 karma points
    Dec 13, 2011 @ 16:08
    Peter Drayton
    0
  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Dec 14, 2011 @ 09:13
    Chriztian Steinmeier
    0

    Hi Peter,

    Did you delete the follow-up question, or did the forum eat it?

    /Chriztian

  • Peter Drayton 29 posts 49 karma points
    Dec 14, 2011 @ 10:31
    Peter Drayton
    0

    I couldn't figure out how to delete it? I just edited it and removed the txt. Was having a brain-fart moment ;-)

    I do have another question though which is at: http://our.umbraco.org/forum/using/ui-questions/26763-Rendering-a-UserControl-inside-of-an-xslt-Macro

    The only way I can figure out how to do it is by putting some C# code in the masterpage, probably not the best practise, but I can;t figure out another way of doing it.

    Peter.

  • 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