Copied to clipboard

Flag this post as spam?

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


  • Sophie Mitchell 23 posts 43 karma points
    Feb 09, 2012 @ 16:52
    Sophie Mitchell
    0

    Help rendering content using content picker

    Hello - I've got a problem with content picker and I'm sure I have made mistakes in the xslt.

    I have created an xslt file in order to render the content (nodeName and summary) of a selected source. In order to display this information on other templates in my website. The xslt I've created seems to only display a selected source's children (nodeName and summary) - rather than it's own.

    Could someone let me know the changes I need to make. Here's my code:

    <xsl:output method="xml" omit-xml-declaration="yes"/>

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

        <xsl:template match="/">

    <ul>

    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
      
    <xsl:sort select="@createDate" order="ascending" />
    <xsl:if test="position() &lt;= $maxItems">
      
       <li>
        <h2><a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/>
          </a></h2>

        <p>
        <xsl:value-of select="summary"/>
        </p>
        
      </li>
      </xsl:if>
    </xsl:for-each>
    </ul>

    </xsl:template>

    Thank you!

  • Rodion Novoselov 694 posts 859 karma points
    Feb 09, 2012 @ 17:20
    Rodion Novoselov
    0

    Hi. To display both the node and its children you can use the "descendant-or-self::" like this:


    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/descendant-or-self::*[@isDoc and string(umbracoNaviHide) != '1']">
       <!- here goes rendering stuff -->
    </xsl:for-each>

  • Sophie Mitchell 23 posts 43 karma points
    Feb 09, 2012 @ 17:39
    Sophie Mitchell
    0

    Perfect - thank you.

Please Sign in or register to post replies

Write your reply to:

Draft