I'm trying to use a nested for-each, basically I need the 'BundleTitle' of each item within our umbraco.config and then for each of thise titles I need the 'EventTitle' which exists for each 'BundleTitle', but I'm not having much success, can you help? This is what I have so far:
In the second for-each you have a duplicate "/node", shouldn't that be just one of them??
ancestor-or-self::root/node/node
By the way, instead of "::root" you might want to use "::node", in case you're ever going to do a multisite / multiple language versions for this site..
This should give you the node homepage-node of the $currentPage and then check in the tree for a node with a nodeName of Johann Strauss Gala. And the take the childnodes of the selected node.
Nested XSL for-each
Hi all,
I'm trying to use a nested for-each, basically I need the 'BundleTitle' of each item within our umbraco.config and then for each of thise titles I need the 'EventTitle' which exists for each 'BundleTitle', but I'm not having much success, can you help? This is what I have so far:
<xsl:for-each select="$currentPage/ancestor-or-self::root/node [@nodeTypeAlias='WhatsOn']/node">
<xsl:variable name="varBundleName" select="data [@alias = 'BundleTitle']"/>
<li><xsl:value-of select="data [@alias = 'BundleTitle']"/></li>
<xsl:for-each select="$currentPage/ancestor-or-self::root/node/node [@alias=$varBundleName]/node">
<xsl:value-of select="data [@alias = 'EventTitle']"/>
</xsl:for-each>
</xsl:for-each>
Thanks.
What is the result you're getting right now?
In the second for-each you have a duplicate "/node", shouldn't that be just one of them??
ancestor-or-self::root/node/nodeBy the way, instead of "::root" you might want to use "::node", in case you're ever going to do a multisite / multiple language versions for this site..
Hi Darryl
You could try to make some kind of debugging in your for-each. First of all try to check if the correct content is in your $varBuncleName like this:
<textarea> <xsl:copy-of select="$varBundleName" /> </textarea>If this one i empty, you should maybe try to create the variable like this:
If your variable contains the right content, just say so, and I'll have another look at it.
/Kim A
The variable contains the right name, I swapped the output for the variable name and it still works:
<ul> <xsl:for-each select="$currentPage/ancestor-or-self::root/node [@nodeTypeAlias='WhatsOn']/node"> <xsl:variable name="varBundleName" select="data [@alias = 'BundleTitle']"/> <li><xsl:value-of select="$varBundleName"/></li> <xsl:for-each select="$currentPage/ancestor-or-self::node/node [@alias=$varBundleName]/node"> <div><xsl:value-of select="data [@alias = 'EventTitle']"/></div> </xsl:for-each> </xsl:for-each>
</ul>
Clearly I'm hitting this in a recursive DataTable fashion, my weakness is XSL, here is some of the umbraco.config:
<!DOCTYPE umbraco[ <!ELEMENT nodes ANY> <!ELEMENT node ANY> <!ATTLIST node id ID #REQUIRED> ]> <root id="-1"> <node id="1133" version="b5fede07-c322-42df-8211-94e659dfa070" parentID="-1" level="1" writerID="0" creatorID="0" nodeType="1132" template="1079" sortOrder="0" createDate="2010-02-09T16:58:05" updateDate="2010-02-09T16:58:11" nodeName="Home" urlName="home" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="HomePage" path="-1,1133" /> <node id="1106" version="3af5aaa6-895c-4c42-b837-7a2acee62093" parentID="-1" level="1" writerID="0" creatorID="0" nodeType="1105" template="0" sortOrder="1" createDate="2010-01-20T11:12:18" updateDate="2010-01-20T11:12:31" nodeName="What's On" urlName="what's-on" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="WhatsOn" path="-1,1106"> <node id="1137" version="ee2732d9-2ea0-4a50-9281-263e5a66fd6d" parentID="1106" level="2" writerID="0" creatorID="0" nodeType="1125" template="0" sortOrder="2" createDate="2010-02-10T16:03:54" updateDate="2010-02-10T16:04:27" nodeName="Johann Strauss Gala" urlName="johann-strauss-gala" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="Bundle" path="-1,1106,1137"> <data alias="BundleTitle">Johann Strauss Gala</data> <data alias="BundleDescription"><![CDATA[ <p style="color: #ffffff; font-size: 12px; padding-bottom: 0px; padding-left: 10px; padding-right: 10px; padding-top: 0px; text-align: center"> <em>Waltz back in time to the glittering ballrooms of 19th Century Vienna with a magical mix of music, song and dance from the Strauss Family and friends.<br /> <br /> <strong>THE BLUE DANUBE WALTZ <br /> TRITSCH TRATSCH POLKA RADETZKY MARCH PLAPPERMAULCHEN POLKA PERPETUUM MOBILE WIENER BLUT WINE, WOMEN AND SONG DIE FLEDERMAUS OVERTURE <em></em>CHAMPAGNE POLKA ROSES IN TYROL PIZZICATO POLKA <br /> THE LAUGHING SONG <em>FROM DIE FLEDERMAUS <br /> </em> THUNDER AND LIGHTNING POLKA<br /> </strong><br /> <strong>JOHANN STRAUSS ORCHESTRA</strong><br /> directed from the violin in traditional Viennese <br /> by <br /> <strong>DAVID JURITZ</strong><br /> with the beautiful young soprano<br /> <strong>CAROLINE MACPHIE<br /> </strong><br /> <strong>JOHANN STRAUSS DANCERS</strong><br /> <em>in exquisite costumes of the period<br /> <br /> </em><em>Choreography & Staging - Christopher Hampso</em></em></p> <br /> <br /> ]]></data> <data alias="BundleMedia" /> <data alias="BundleFeature">0</data> <node id="1138" version="b977f67c-772e-41fb-8027-f67401c0e933" parentID="1137" level="3" writerID="0" creatorID="0" nodeType="1126" template="1079" sortOrder="1" createDate="2010-02-10T16:05:21" updateDate="2010-02-10T16:14:20" nodeName="Barbican Centre" urlName="barbican-centre" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="Event" path="-1,1106,1137,1138"> <node id="1139" version="6724c66b-4027-4ce9-99c3-4956b76093d4" parentID="1138" level="4" writerID="0" creatorID="0" nodeType="1127" template="0" sortOrder="1" createDate="2010-02-10T16:06:29" updateDate="2010-02-10T16:08:04" nodeName="Afternoon Performance" urlName="afternoon-performance" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="Performance" path="-1,1106,1137,1138,1139"> <data alias="PerformanceVenue"><![CDATA[]]></data> <data alias="PerformanceFeature">0</data> <data alias="PerformanceDescription"><![CDATA[]]></data> <data alias="PerformanceDateTime">2009-12-31T15:00:00</data> <data alias="PerformanceBookingURL"><![CDATA[]]></data> <data alias="PerformanceBoxOffice" /> <data alias="PerformanceTicketPrices"><![CDATA[]]></data> </node> <data alias="EventTitle">Barbican Centre - London</data> <data alias="EventDescription"><![CDATA[]]></data> <data alias="EventMedia" /> <data alias="EventCategory"><![CDATA[Opera]]></data> <data alias="EventFeature">0</data> </node> <node id="1140" version="46fcaf52-2f00-4a52-95d8-9b5c560d9d6e" parentID="1137" level="3" writerID="0" creatorID="0" nodeType="1126" template="1079" sortOrder="2" createDate="2010-02-10T16:09:42" updateDate="2010-02-10T16:12:11" nodeName="Symphony Hall - Birmingham" urlName="symphony-hall---birmingham" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="Event" path="-1,1106,1137,1140"> <data alias="EventTitle">Symphony Hall - Birmingham</data> <data alias="EventDescription"><![CDATA[]]></data> <data alias="EventMedia" /> <data alias="EventCategory"><![CDATA[Ballet]]></data> <data alias="EventFeature">0</data> <node id="1141" version="5a61d68f-50d6-44e1-9920-cd6a07fc618c" parentID="1140" level="4" writerID="0" creatorID="0" nodeType="1127" template="0" sortOrder="1" createDate="2010-02-10T16:12:25" updateDate="2010-02-10T16:12:53" nodeName="Afternoon Performance" urlName="afternoon-performance" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="Performance" path="-1,1106,1137,1140,1141"> <data alias="PerformanceVenue"><![CDATA[]]></data> <data alias="PerformanceFeature">0</data> <data alias="PerformanceDescription"><![CDATA[]]></data> <data alias="PerformanceDateTime">2010-01-01T15:00:00</data> <data alias="PerformanceBookingURL"><![CDATA[]]></data> <data alias="PerformanceBoxOffice" /> <data alias="PerformanceTicketPrices"><![CDATA[]]></data> </node> </node>Hmm I just took the following XSL:
<li><xsl:value-of select="data [@alias = 'EventTitle']"/></li>And put it into a separate XSLT File and it does pull back the event titles for that event...
I think it should work but it doesn't, any better ideas?
Hmm...
Could you try this one out:
This should give you the node homepage-node of the $currentPage and then check in the tree for a node with a nodeName of Johann Strauss Gala. And the take the childnodes of the selected node.
Hope this helps.
/Kim A
Genius - thank you sir!
You are very welcome.
/Kim A
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.