Copied to clipboard

Flag this post as spam?

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


  • Alistair Graham 22 posts 62 karma points
    Dec 22, 2010 @ 17:42
    Alistair Graham
    0

    XSLT ContentPicker Problems

    Hi Guys

    I am fairly new to umbraco and XSLT, loving it so far. I have found most of my solutions to problems on the forums which is brilliant.

    Currently I am having a problem with a content picker and XSLT. I have had a look around the forums and other people have had the same problems and I still haven't been able to solve it. I am sure its something simple I am forgetting to do.

    I have a content picker on the page, you select a page and I want to show the content from that page.

    I have pasted my XSLT below, the content picker is called “snippet1”, if I pass GetXmlNodeById the id of the page it populates the data correctly (which is commented out in the code below). If I try to use the picker version no data is shown.

      <xsl:param name="currentPage" />
      <xsl:variable name="box1Node" select="umbraco.library:GetXmlNodeById($currentPage/data[@alias = 'snippet1'])"/>
      <!--<xsl:variable name="box1Node" select="umbraco.library:GetXmlNodeById(1097)"/>-->
      <xsl:template match="/">
             <xsl:value-of select="$box1Node/pageTitle"/>
             <xsl:value-of select="$box1Node/pageContent" disable-output-escaping="yes"/>
      </xsl:template>

    Any help or pointing me in the right direction would be great.

    Cheers

    Alistair

  • Alistair Graham 22 posts 62 karma points
    Dec 22, 2010 @ 17:49
    Alistair Graham
    0

    I have also tired,

      <xsl:param name="currentPage" />
     <xsl:variable name="box1Node" select="umbraco.library:GetXmlNodeById($currentPage/data[@alias = 'snippet1'])"/>
     
      <xsl:template match="/">
        <div class="ItRunsTheXSLTNoCodeFound">   
          <xsl:value-of select="$box1Node/data [@alias = 'pageTitle']"/>
          <xsl:value-of select="$box1Node/data [@alias = 'pageContent']" disable-output-escaping="yes"/>
        </div>
    </xsl:template>

    Still not had any luck.

    Cheers

     

    Alistair

     


  • Tom Fulton 2030 posts 4998 karma points c-trib
    Dec 22, 2010 @ 18:13
    Tom Fulton
    0

    Hi,

    It looks like you are using the old XML schema and probably therefore not getting any results for snippet1.  If you are using umbraco 4.5 and have not explicitly set it to use the old XML schema, you should change:

    $currentPage/data [@alias='snippet1']

    to:

    $currentPage/snippet1

    More info here:  http://our.umbraco.org/wiki/reference/xslt/45-xml-schema

     

  • Alistair Graham 22 posts 62 karma points
    Dec 22, 2010 @ 18:22
    Alistair Graham
    0

    Hi Tom

    Thanks for your help and the link that has worked straight away,

    Cheers

    Alistair

Please Sign in or register to post replies

Write your reply to:

Draft