tags:

views:

178

answers:

1

I need to say; I'm pretty green in xslt so, most likely, that's the main problem; nonetheless been on it for hours and can't get it. I want to fill a column on my main template with the 5 most recent newsitems. These newsitems should be shown regardless of the currentpage. I've tried this:

  <xsl:template match="/">
    <xsl:for-each select="umbraco.library:GetXmlNodeById(1075)/child::node">
        <p>
          <strong>
            <xsl:value-of select="header"/>
          </strong>
       </p>
    </xsl:for-each>
  </xsl:template>

Where, at the moment, 1075 is my News template. Ive tried it with just: GetXmlNodeById(1076)/node (where 1076) is my NewsItem template. I've tried it with the node-Id's from the content-tree, but no luck..

Anyone able to help me out here? Am stuck and I've searched high and low on Google, the forums and documentation, but I'm most likely missing something vital here. TIA!

P.S. Using Umbraco 4.5 BTW

+1  A: 

This should output current and child nodes.

<xsl:copy-of select="umbraco.library:GetXmlNodeById(1075)"/>

In Umbraco 4.5 the schema has changed, from /node[@nodeTypeAlias='News'] to /News [@isDoc]

http://blog.leekelleher.com/2010/04/02/working-with-xslt-using-new-xml-schema-in-umbraco-4-1/

So your xslt should look like

<xsl:template match="/">
    <ul>
        <xsl:for-each select="umbraco.library:GetXmlNodeById(1075)/News [@isDoc]">
            <li><a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a></li>
       </xsl:for-each>
    </ul>
</xsl:template>
Elijah Glover
Thanks! This is it indeed. Was confused by all the samples from older schema's I guess, but it's working!
riffnl
No problems, any time
Elijah Glover