Hi, Im tearing my hair out trying to understand xslt. I have created a document type called 'homepage banner'. All these homepage banners will be created under a folder in the content tree. Im trying to work out how to display all these banners on the homepage using xslt.
currently im just trying to get it to display some text for each banner it finds but failing miserably. :(
<xsl:template match="/"> //get all the children of children <xsl:for-each select="currentPage/descendant::node"> // check if its a homepage banner document type (im not sure if nodeTypeAlias is correct) <xsl:if test="currentPage/descendant::node[@nodeTypeAlias='Homepage Banner']">
<xsl:for-each select="currentPage/descendant::node">
// check if its a homepage banner document type (im not sure if nodeTypeAlias is correct)
<xsl:if test="./[@nodeTypeAlias='Homepage Banner']">
this is a banner
</xsl:if>
</xsl:for-each>
Display Banners In Folder
Hi, Im tearing my hair out trying to understand xslt. I have created a document type called 'homepage banner'. All these homepage banners will be created under a folder in the content tree. Im trying to work out how to display all these banners on the homepage using xslt.
currently im just trying to get it to display some text for each banner it finds but failing miserably. :(
<xsl:template match="/">
//get all the children of children
<xsl:for-each select="currentPage/descendant::node">
// check if its a homepage banner document type (im not sure if nodeTypeAlias is correct)
<xsl:if test="currentPage/descendant::node[@nodeTypeAlias='Homepage Banner']">
this is a banner
</xsl:if>
</xsl:for-each>
</xsl:template>
I cannot get my head around xslt at all.
You are in a for-each loop
try this:
hmm im getting this error: Unexpected token '[' in the expression.
./ -->[<-- @nodeTypeAlias='Homepage Banner'
:) ΟΚ. I'm not in front of an editor right now.
Try removing the brackets
or
Ha, thanks for your help dimitris. Im not getting any errors now but im not getting any result either.
heres my tree:
homepage
--page1
--page2
--page3
--homepage banners folder
----banner1
----banner2
----banner3
So i need the xslt on the homepage to show all of the banners inside the homepage banners folder. Is my syntax along the right lines or am i way off?
In front of currentPage you are missing the $ symbol. Is it a typo?
solved. silly typo. doh.
is working on a reply...