Each project has a thumbnail and each item has two enlargements called large and largedetail.
I want to generate a list of thumbnails to be displayed on NodeX. I also want to generate a list of the large items with a href (fancybox) on it which displays largedtail.
The for-each loop isn't a problem, but displaying the different fields is. BTW, another question, does a for-each loop always loop in the order which is given on the backend?
In the sort's select attribute you can specify an XPath expression, which can be as simple as an attribute (as in this example) or a complex calculation.
The best way to do something like this is actually to create a template for a single Project and instead of using for-each, use the apply-templates instruction - short sample here:
As you can see, the apply-templates instruction enables you to extract the Project markup (so it doesn't have to live inside the for-each) so it's easier to maintain (and re-use).
Once you get this working you'll be able to start tweaking. If you already have the complete HTML for a Project it should be quite easy to start picking the dynamic parts from within the template.
What's still a problem is the following. Item is a child of Portfolio, a child has an image with the alias display. It seemed logic to me to loop through alle Items like coded below. Regard my point of origin from where xslt is running is the node above Portfolio.
I hope I've epxlained it a bit more like this. Please any help on what I'm doing wrong
stuck in Xslt
I have made the following structure.
NodeX
+ Project
- Items
- Items
+ Project
- Items
- Items
Each project has a thumbnail and each item has two enlargements called large and largedetail.
I want to generate a list of thumbnails to be displayed on NodeX.
I also want to generate a list of the large items with a href (fancybox) on it which displays largedtail.
The for-each loop isn't a problem, but displaying the different fields is.
BTW, another question, does a for-each loop always loop in the order which is given on the backend?
Any help is appreciated.
Greetz, Patrick
Hi Patrick,
To start at the bottom: You can shove a sort instruction inside a for-each to specify the sort order, e.g.:
In the sort's select attribute you can specify an XPath expression, which can be as simple as an attribute (as in this example) or a complex calculation.
The best way to do something like this is actually to create a template for a single Project and instead of using for-each, use the apply-templates instruction - short sample here:
As you can see, the apply-templates instruction enables you to extract the Project markup (so it doesn't have to live inside the for-each) so it's easier to maintain (and re-use).
Once you get this working you'll be able to start tweaking. If you already have the complete HTML for a Project it should be quite easy to start picking the dynamic parts from within the template.
Hope this helps ...
/Chriztian
It helps, but I'm not there yet.
What's still a problem is the following.
Item is a child of Portfolio, a child has an image with the alias display.
It seemed logic to me to loop through alle Items like coded below.
Regard my point of origin from where xslt is running is the node above Portfolio.
I hope I've epxlained it a bit more like this.
Please any help on what I'm doing wrong
<xsl:for-each select="$currentPage/ancestor-or-self::root//Portfolio/Item">
<li>
<xsl:variable name="media" select="umbraco.library:GetMedia(display, 'false')" />
</li>
</xsl:for-each>
is working on a reply...