Copied to clipboard

Flag this post as spam?

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


  • dave2112 17 posts 35 karma points
    Oct 10, 2013 @ 18:30
    dave2112
    1

    Content Picker Parameter to XSLT

    Hi all, I am trying to do something fairly simple but I cannot seem to get this to work.

    I have a simple macro which has a content picker parameter called "linkOne".

    When I try to extract this out in XSLT I was expecting the ID of the selected page to come out. However it brings back the whole document xml for the chosen page. Even if I don't select a page in the content picker, the XSLT returns the whole XML structure of the current page.

    Am I missing something really simple?

    <xsl:variable name="link1" select="/macro/linkOne"/>

    Link one <xsl:value-of select="$link1" /> ... this returns the whole xml structure for the node

    Thanks in advance

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Oct 10, 2013 @ 21:54
    Chriztian Steinmeier
    0

    Hi Dave,

    Can you double check that the type of the macro parameter is Content Picker and not Content Random or Content Tree? Those are (to my knowledge) the only ones returning XML from content nodes...

    If you have indeed specified Content Picker as the type, then we need to dig deeper - there could be a bug somewhere that no-one has seen yet.

    Which version of Umbraco are you experiencing this in?

    /Chriztian

  • Vishmay 19 posts 100 karma points
    Jan 30, 2017 @ 13:14
    Vishmay
    0

    Found the case,

    If you use currentPage as variable for content picker then it will load whole page there as it is reserved variable i think

  • dave2112 17 posts 35 karma points
    Oct 11, 2013 @ 10:36
    dave2112
    1

    Hi Chriztian

    It is definately a content picker. The macro itself is being inserted through TinyMce into the page content. When I pull the value back out it gives me the whole page node xml. I'm running 6.1.0.

    Thanks

  • Vishmay 19 posts 100 karma points
    Jan 30, 2017 @ 13:07
    Vishmay
    0

    continued same bug in version 7

  • Vishmay 19 posts 100 karma points
    Jan 30, 2017 @ 13:13
    Vishmay
    0

    Found the case,

    If you use currentPage as variable for content picker then it will load whole page there as it is reserved variable i think

    I solved by it by restoring my currentPage variable as it was and took a new variable named selectedPage(any other).

    Wrong Way

    <xsl:param name="currentPage" select="/macro/currentPage"/>
    

    Right way

    <xsl:param name="currentPage"/>
    <xsl:param name="selectedPage" select="/macro/selectedPage"/>
    
  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Jan 30, 2017 @ 13:15
    Chriztian Steinmeier
    0

    Ah - that makes sense :)

  • Vishmay 19 posts 100 karma points
    Jan 31, 2017 @ 07:07
  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Jan 30, 2017 @ 13:14
    Chriztian Steinmeier
    0

    Hi,

    Well - if the macro parameter returns the full structure, then the node's id would be in $link1/@id - but since you'd most likely be using that to get to the node, you could just use the node you already have, e.g. ig you need to output its name, you'd say:

    <xsl:value-of select="$link1/@nodeName" />
    

    What is it do you're specifically trying to do - is it not possible inthis way?

    /Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft