I'm trying to create a carousel that will be displayed on multiple pages. I have added objects of type 'carouselitem', which have an image and a caption properties, under the homepage and I can select them using the xslt below:
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here --> <xsl:variable name="documentTypeAlias" select="string('CarouselItem')"/>
This xslt is called in the master file, and it works fine for the homepage which has the carouselitem objects under it. However I need to create more pages under the homepage which will use the same master file and display the same carousel content.
When I add a new page it does not display the items in the carousel. I presume I need to select the parent node and then the items? I have tried this:
get content from parent page
I'm trying to create a carousel that will be displayed on multiple pages. I have added objects of type 'carouselitem', which have an image and a caption properties, under the homepage and I can select them using the xslt below:
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here -->
<xsl:variable name="documentTypeAlias" select="string('CarouselItem')"/>
<xsl:template match="/">
<div id="wwhomepagecarousel">
<xsl:for-each select="$currentPage/*[name() = $documentTypeAlias]">
<div class="carousel">
<div class="carouselcaption"><p><xsl:value-of select="caption" disable-output-escaping="yes" /></p></div>
<img class="carouselimage" width="500px" height="334" src="{umbraco.library:GetMedia(image,0)/umbracoFile}"/>
</div>
</xsl:for-each>
</div>
</xsl:template>
This xslt is called in the master file, and it works fine for the homepage which has the carouselitem objects under it. However I need to create more pages under the homepage which will use the same master file and display the same carousel content.
When I add a new page it does not display the items in the carousel. I presume I need to select the parent node and then the items? I have tried this:
<xsl:for-each select="$currentPage/parent::node/*[name() = $documentTypeAlias]">
But it did not work.
Any suggestions?
Hi Barry,
Since your homepage contains the CarouselItem, this is accomplished simply by finding the root node first, and using that as the "base":
/Chriztian
is working on a reply...