I'm using damp to add slideshow images to my pages. Each page can have it's own slideshow but if the current page doesn't have a slideshow I'd like to recurse up the tree and find the first parent / grand parent that does.
To select a property recursivly I'd normally do something like this
<xsl:variable name="data" select="$currentPage/ancestor-or-self::* [@isDoc and string(headerImage) != ''][1]/headerImage" />
But I'm not sure how to do that with damp. This is how I am selecting the slideshow images for the current page
The slide is a property of my content page document type with alias "bannerSlides". That property type is a data type I have set up that uses the damp with it set to save the full xml.
But if you have a node for each slide you are able to set other properties like a link, umbracoNaviHide property to hide the slide item and what else you might need.. or you could create a media item with more properties than the default properties.. but I prefer using content nodes/document types for this.
Yes, it will select nodes which use SlideItem as document types.. there are multiple ways to create slideshows.. if you need more properties than just an image, it's probably better to use content nodes.. but if you only need to show images, you can select multiple images with DAMP or select a folder from media section either with the media picker or DAMP and loop through the folder images.
I'm not sure you always get the images depending on where the currentpage with the slideshow is in the structure.. therefore I usually starts from root nodes and look through the structure..
Select images from damp recursivly
I'm using damp to add slideshow images to my pages. Each page can have it's own slideshow but if the current page doesn't have a slideshow I'd like to recurse up the tree and find the first parent / grand parent that does.
To select a property recursivly I'd normally do something like this
But I'm not sure how to do that with damp. This is how I am selecting the slideshow images for the current page
<xsl:variable name="data" select="$currentPage/bannerSlides/DAMP/mediaItem" />
How do I modify this to select recursivly.
Hi ..
How is the content nodes structured?
Do you have a slideshow node with children foreach slide item?
I usually access each slide node either from a node with a master doc type, where MainMaster is my master doc type.
or from root:
Then you can loop through each slide item and get the properties on the slide item.
In the loop you can easily get the images with DAMP stored as xml:
/Bjarne
The slide is a property of my content page document type with alias "bannerSlides". That property type is a data type I have set up that uses the damp with it set to save the full xml.
Yes.. so you choose all slide images from the property with DAMP as datatype?
but you can also loop through each selected image..
But if you have a node for each slide you are able to set other properties like a link, umbracoNaviHide property to hide the slide item and what else you might need.. or you could create a media item with more properties than the default properties.. but I prefer using content nodes/document types for this.
/Bjarne
Sorry I don't understand what you mean. As I understand itthis
$currentPage/ancestor-or-self::root/descendant-or-self::SlideItem
will select SlideItem nodes. My slides are not their own document type though.
Actually I think I just worked it out. The following seems to work
Yes, it will select nodes which use SlideItem as document types.. there are multiple ways to create slideshows.. if you need more properties than just an image, it's probably better to use content nodes.. but if you only need to show images, you can select multiple images with DAMP or select a folder from media section either with the media picker or DAMP and loop through the folder images.
I'm not sure you always get the images depending on where the currentpage with the slideshow is in the structure.. therefore I usually starts from root nodes and look through the structure..
I think this will work too..
I often think this Xpath visualizer is a great help to get the data you want: http://pimpmyxslt.com/axesviz.aspx
/Bjarne
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.