Reputation: 1297
Very new to Umbraco and .net, have been getting on fairly well putting my first site together. However, I've hit a bit of a stumbling block where I have set up a document type called Testimonial Article, which I want to retrieve and loop through in the XSLT file. I have set up a Macro which is linked to this XSLT file, and I've created and published a Testimonial Article - but there is no results seemingly.
I am assuming I am trying to access the document type incorrectly in the XSLT file?
In Testimonials.xslt, very basic:
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:for-each select="umbraco.library:GetXmlAll()//node[@nodeTypeAlias = 'TestimonialArticle']" >
<p>Result</p>
</xsl:for-each>
</xsl:template>
I have created a Testimonial with document type Testimonial Article:
And this is my doc type:
Upvotes: 0
Views: 1144
Reputation: 21
I believe doing //node
is the old way of doing it. I've replaced it with an //*
Doing //TestimonialArticle
should also work as well instead of umbraco.library:GetXmlAll()//*[@nodeTypeAlias = 'TestimonialArticle']
You may find this package helpful when creating your xpath: http://our.umbraco.org/projects/developer-tools/umbraco-xpath-evaluator
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:for-each select="umbraco.library:GetXmlAll()//*[@nodeTypeAlias = 'TestimonialArticle']" >
<p>Result</p>
</xsl:for-each>
</xsl:template>
Upvotes: 1
Reputation: 2915
with XSLT you'd normally start from some "referencePoint" - in Umbraco that is normally the currentPage variable, and then you go from there - (pseudo code): "currentpage - children - where documentType is .." etc
Have a look here: http://our.umbraco.org/wiki/reference/xslt/the-basics
Upvotes: 0