What version of Umbraco are you using? It looks like your XSLT is using the old schema...if you are using 4.5+ and haven't specifically told it to use the old schema, you should be using this format instead:
I am using Umbraco v 4.0.3 so I neeed to reference the old schema.
The output of $mediaNode in the visualiser is
/media/723212/test1.jpg/media/723213/test1-tn.jpgTest test test test test test test/media/723223/dxd.jpg/media/723224/dxd.jpgDXD Fridge Freezer in black in a Contemporary Kitchen/media/723266/elite-se-new-rs2.jpg/media/723267/elite-se-new-rs2.jpgElite SE 110 in Stainless steel with complementary Elite Hood/media/723317/elite-se-rs.jpg/media/723318/elite-se-rs.jpgElite SE 110 stainless steel featured in a modern kitchen /media/723325/excel_53.jpg/media/723326/excel_53.jpgExcel 110 in Black with matching Splashback and Hood/media/723329/excel-roomset.jpg/media/723330/excel-roomset.jpgExcel 110 in Stainless Steel featured in a contemporary kitchen/media/723333/fxf_rs.jpg/media/723334/fxf_rs.jpgFxF 60:40 Refrigerator in Stainless Steel/media/723337/fxp_rng.jpg/media/723338/fxp_rng.jpgProfessional + FXP 90 in Stainless Steel with a complementary Galaxy GLX 390 Hood /media/723341/m07_closed.jpg/media/723342/m07_closed.jpgStainless Steel Beverage Centre that has a storage capacity of 172 litres/media/723345/moderners_classic100.jpg/media/723346/moderners_classic100.jpgClassic Deluxe 100 Dual Fuel in Black/media/723369/oyster-appliance-all-closed.jpg/media/723370/oyster-appliance-all-closed.jpgDual Zone wine storage in stainless steel and the R9049 Built in Oven featured in a Contemporary Oyster styled Kitchen/media/723373/pro+fx.jpg/media/723374/pro+fx.jpgProfessional + FX 90 Dual Fuel in Stainless Steel/media/723382/rangemaster-pro+-rscrop.jpg/media/723383/rangemaster-pro+-rscrop.jpgProfessional + 110 in Stainless Steel with Rangemaster 110 Flat Hood and 110 Splashback /media/723390/sink.jpg/media/723391/sink.jpgRangemaster Cubix Gemini 1 1/2 bowl sink in Neostone Granite Black with a Crucifrom tap in a Brushed finish/media/723394/toledo-110-metro_new.jpg/media/723395/toledo-110-metro_new.jpgToledo 110 Induction in Black in a modern kitchen/media/723398/toledo-fs-hero.jpg/media/723399/toledo-fs-hero.jpgToledo 110 in Stainless Steel in a large contemporary kitchen/media/723402/toledo-xt.jpg/media/723403/toledo-xt.jpgToledo 110 Induction in Stainless Steel featured in a kitchen setting
which is the ouput I would expect but after that I get nothing!
If you can, try outputting the mediaNode with the copy-of textarea snippet I pasted above, it will show you the complete XML (with elements/tags/etc) so it's easier to debug. Hard to see the structure in the snippet you pasted.
Also, if my memory serves me correctly, this might be the correct way instead:
can get media but XSLT not generating an output
Hi,
I am looping through a media folder which is definately generating an output because I've tested it using value-of select
But, when I try and loop through to display 'GalleryImage' (a Media Type) nothing is ouptut?
Am I missing something?
Thanks,
Rachel
The select statement in a for-each loop, defines the top nodes that are passed into the loop.
Change the xsl:value-of with
and you will see the XML that is contained within the variable mediaNode.
I would expect that you want, with the new schema:
the old schema will have Node instead of "File".
Hi Rachel,
What version of Umbraco are you using? It looks like your XSLT is using the old schema...if you are using 4.5+ and haven't specifically told it to use the old schema, you should be using this format instead:
or if you want a "deep" search
More info on the new schema here: http://our.umbraco.org/wiki/reference/xslt/45-xml-schema
If that didn't do the trick, try outputting the contents of your $mediaNode variable in a textarea so we can see what XML is getting returned:
-Tom
Hi Both,
I am using Umbraco v 4.0.3 so I neeed to reference the old schema.
The output of $mediaNode in the visualiser is
/media/723212/test1.jpg/media/723213/test1-tn.jpgTest test test test test test test/media/723223/dxd.jpg/media/723224/dxd.jpgDXD Fridge Freezer in black in a Contemporary Kitchen/media/723266/elite-se-new-rs2.jpg/media/723267/elite-se-new-rs2.jpgElite SE 110 in Stainless steel with complementary Elite Hood/media/723317/elite-se-rs.jpg/media/723318/elite-se-rs.jpgElite SE 110 stainless steel featured in a modern kitchen /media/723325/excel_53.jpg/media/723326/excel_53.jpgExcel 110 in Black with matching Splashback and Hood/media/723329/excel-roomset.jpg/media/723330/excel-roomset.jpgExcel 110 in Stainless Steel featured in a contemporary kitchen/media/723333/fxf_rs.jpg/media/723334/fxf_rs.jpgFxF 60:40 Refrigerator in Stainless Steel/media/723337/fxp_rng.jpg/media/723338/fxp_rng.jpgProfessional + FXP 90 in Stainless Steel with a complementary Galaxy GLX 390 Hood /media/723341/m07_closed.jpg/media/723342/m07_closed.jpgStainless Steel Beverage Centre that has a storage capacity of 172 litres/media/723345/moderners_classic100.jpg/media/723346/moderners_classic100.jpgClassic Deluxe 100 Dual Fuel in Black/media/723369/oyster-appliance-all-closed.jpg/media/723370/oyster-appliance-all-closed.jpgDual Zone wine storage in stainless steel and the R9049 Built in Oven featured in a Contemporary Oyster styled Kitchen/media/723373/pro+fx.jpg/media/723374/pro+fx.jpgProfessional + FX 90 Dual Fuel in Stainless Steel/media/723382/rangemaster-pro+-rscrop.jpg/media/723383/rangemaster-pro+-rscrop.jpgProfessional + 110 in Stainless Steel with Rangemaster 110 Flat Hood and 110 Splashback /media/723390/sink.jpg/media/723391/sink.jpgRangemaster Cubix Gemini 1 1/2 bowl sink in Neostone Granite Black with a Crucifrom tap in a Brushed finish/media/723394/toledo-110-metro_new.jpg/media/723395/toledo-110-metro_new.jpgToledo 110 Induction in Black in a modern kitchen/media/723398/toledo-fs-hero.jpg/media/723399/toledo-fs-hero.jpgToledo 110 in Stainless Steel in a large contemporary kitchen/media/723402/toledo-xt.jpg/media/723403/toledo-xt.jpgToledo 110 Induction in Stainless Steel featured in a kitchen setting
which is the ouput I would expect but after that I get nothing!
If it helps, my complete xslt is below
<xsl:if test="$currentPage/galleryFolder">
<xsl:variable name="mediaNode" select="umbraco.library:GetMedia(4768, 1)" />
<xsl:copy-of select="$mediaNode"/>
<div id="imagegallery">
<div id="galleryslides">
<xsl:for-each select="$mediaNode/descendant::data[@alias='GalleryImage']">
<xsl:sort order="ascending" select="@sortOrder" />
<xsl:variable name="largepic" select="umbraco.library:GetMedia(@id, 0)" />
<div class="galleryslide">
<img src="{$largepic/data[@alias='largeImage']}" alt="{$largepic/@nodeName}" width="692" height="450" />
<div class="overlay">
<div class="overlaytext"><xsl:value-of select="$largepic/data[@alias='slideOverlayText']" disable-output-escaping="yes" /></div>
</div>
</div>
</xsl:for-each>
</div>
<div id="gallerythumbholder">
<div id="gallerythumbwrap">
<a id="galleryprev" href="#"><img src="/media/723357/small_arrow_left.jpg" alt="Previous Images" /></a>
<a id="gallerynext" href="#"><img src="/media/723363/small_arrow_right.jpg" alt="Next Images" /></a>
<div class="overflowhidden">
<div id="gallerythumbs">
<xsl:for-each select="$mediaNode/descendant::data[@alias='GalleryImage'] ">
<xsl:sort order="ascending" select="@sortOrder" />
<xsl:variable name="thumb" select="umbraco.library:GetMedia(@id, 0)" />
<!--<div class="visibleportion">-->
<div class="gallerythumb {umbraco.library:Replace(../@nodeName, ' ', '')}">
<a href="#" class="thumbimage">
<xsl:if test="position() = 1">
<xsl:attribute name="class">
thumbimage activethumb
</xsl:attribute>
</xsl:if>
<img src="{$thumb/data[@alias='thumbnailImage']}" alt="{@nodeName}" width="76" height="64" />
</a>
</div>
<!--</div>-->
</xsl:for-each>
<div class="clear"><xsl:comment>1</xsl:comment></div>
</div>
</div>
</div>
</div>
</div>
</xsl:if>
Thanks,
Rachel
Hi Rachel,
If you can, try outputting the mediaNode with the copy-of textarea snippet I pasted above, it will show you the complete XML (with elements/tags/etc) so it's easier to debug. Hard to see the structure in the snippet you pasted.
Also, if my memory serves me correctly, this might be the correct way instead:
I can't remember back that far though :) But if you paste the textarea contents we should be able to figure it out pretty easily.
Thanks,
Tom
ps. The finished result should look something like this Media Gallery
This was created in Umbraco 4.5.2.
With the old schema, then the following will loop through the items
I agree with Tom, changing the select to
<xsl:for-each select="$mediaNode/node [@nodeTypeAlias='GalleryImage']">
should only list those node types.
Sorry! Here you go...
<node id="4768" version="1906ded5-a720-41d2-a33f-46a2ed268bf1" parentID="4767" level="2" writerID="0" nodeType="4126" template="0" sortOrder="1" createDate="2011-07-19T17:15:34" updateDate="2011-07-19T17:15:34" nodeName="Contemporary" urlName="contemporary" writerName="Administrator" nodeTypeAlias="GalleryFolder" path="-1,4767,4768"><node id="4773" version="d5429d30-a3b7-4af5-be65-97254cb7ceac" parentID="4768" level="3" writerID="0" nodeType="4122" template="0" sortOrder="1" createDate="2011-07-19T17:17:55" updateDate="2011-07-19T17:17:55" nodeName="Test 1" urlName="test1" writerName="Administrator" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4773"><data alias="largeImage">/media/723212/test1.jpg</data><data alias="thumbnailImage">/media/723213/test1-tn.jpg</data><data alias="slideOverlayText">Test test test test test test test</data><data alias="show" /></node><node id="4776" version="8b442a9d-b78e-435a-8a38-c7681437b80a" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="2" createDate="2011-07-20T09:34:40" updateDate="2011-07-20T09:34:40" nodeName="DXD Black" urlName="dxdblack" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4776"><data alias="largeImage">/media/723223/dxd.jpg</data><data alias="thumbnailImage">/media/723224/dxd.jpg</data><data alias="slideOverlayText">DXD Fridge Freezer in black in a Contemporary Kitchen</data><data alias="show" /></node><node id="4784" version="9e5877bf-2453-4f64-9bc9-c2347c6ea426" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="3" createDate="2011-07-20T10:00:33" updateDate="2011-07-20T10:00:33" nodeName="Elite SE 110" urlName="elitese110" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4784"><data alias="largeImage">/media/723266/elite-se-new-rs2.jpg</data><data alias="thumbnailImage">/media/723267/elite-se-new-rs2.jpg</data><data alias="slideOverlayText">Elite SE 110 in Stainless steel with complementary Elite Hood</data><data alias="show" /></node><node id="4785" version="8396acaa-fe87-4242-8066-b60e0c3e5de7" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="4" createDate="2011-07-20T10:15:40" updateDate="2011-07-20T10:15:40" nodeName="Elise SE 110 2" urlName="elisese1102" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4785"><data alias="largeImage">/media/723317/elite-se-rs.jpg</data><data alias="thumbnailImage">/media/723318/elite-se-rs.jpg</data><data alias="slideOverlayText">Elite SE 110 stainless steel featured in a modern kitchen </data><data alias="show" /></node><node id="4787" version="afbc6150-fcd1-4b92-b285-0404a4c8fbcb" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="5" createDate="2011-07-20T10:20:50" updateDate="2011-07-20T10:20:50" nodeName="Excel 110 Black" urlName="excel110black" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4787"><data alias="largeImage">/media/723325/excel_53.jpg</data><data alias="thumbnailImage">/media/723326/excel_53.jpg</data><data alias="slideOverlayText">Excel 110 in Black with matching Splashback and Hood</data><data alias="show" /></node><node id="4788" version="651fb3ad-142b-4876-b79e-9496d94c3cff" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="6" createDate="2011-07-20T10:22:00" updateDate="2011-07-20T10:22:00" nodeName="Excel 110 SS" urlName="excel110ss" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4788"><data alias="largeImage">/media/723329/excel-roomset.jpg</data><data alias="thumbnailImage">/media/723330/excel-roomset.jpg</data><data alias="slideOverlayText">Excel 110 in Stainless Steel featured in a contemporary kitchen</data><data alias="show" /></node><node id="4789" version="5a37c42b-b2e4-4626-94f2-012cca978abf" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="7" createDate="2011-07-20T10:30:30" updateDate="2011-07-20T10:30:30" nodeName="FXF SS" urlName="fxfss" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4789"><data alias="largeImage">/media/723333/fxf_rs.jpg</data><data alias="thumbnailImage">/media/723334/fxf_rs.jpg</data><data alias="slideOverlayText">FxF 60:40 Refrigerator in Stainless Steel</data><data alias="show" /></node><node id="4790" version="c607ba61-15b1-4df5-b7e3-51d634c11956" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="8" createDate="2011-07-20T10:33:15" updateDate="2011-07-20T10:33:15" nodeName="Pro + FXP SS" urlName="pro+fxpss" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4790"><data alias="largeImage">/media/723337/fxp_rng.jpg</data><data alias="thumbnailImage">/media/723338/fxp_rng.jpg</data><data alias="slideOverlayText">Professional + FXP 90 in Stainless Steel with a complementary Galaxy GLX 390 Hood </data><data alias="show" /></node><node id="4791" version="10ae9076-bb9b-4350-b8fb-cf16cba19c35" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="9" createDate="2011-07-20T10:37:04" updateDate="2011-07-20T10:37:05" nodeName="Beverage Centre" urlName="beveragecentre" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4791"><data alias="largeImage">/media/723341/m07_closed.jpg</data><data alias="thumbnailImage">/media/723342/m07_closed.jpg</data><data alias="slideOverlayText">Stainless Steel Beverage Centre that has a storage capacity of 172 litres</data><data alias="show" /></node><node id="4794" version="96a694c4-5b61-43a2-9bdd-af965c0965c3" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="10" createDate="2011-07-20T10:39:26" updateDate="2011-07-20T10:39:26" nodeName="Classic D 110 Black" urlName="classicd110black" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4794"><data alias="largeImage">/media/723345/moderners_classic100.jpg</data><data alias="thumbnailImage">/media/723346/moderners_classic100.jpg</data><data alias="slideOverlayText">Classic Deluxe 100 Dual Fuel in Black</data><data alias="show" /></node><node id="4801" version="3b81e69c-ebd9-4468-80fc-3a22e7a4e697" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="11" createDate="2011-07-20T10:52:19" updateDate="2011-07-20T10:52:19" nodeName="Dual Zone Wine Storage" urlName="dualzonewinestorage" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4801"><data alias="largeImage">/media/723369/oyster-appliance-all-closed.jpg</data><data alias="thumbnailImage">/media/723370/oyster-appliance-all-closed.jpg</data><data alias="slideOverlayText">Dual Zone wine storage in stainless steel and the R9049 Built in Oven featured in a Contemporary Oyster styled Kitchen</data><data alias="show" /></node><node id="4802" version="e4a36b5b-eec9-46c1-8e72-f934bacb3228" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="12" createDate="2011-07-20T10:57:36" updateDate="2011-07-20T10:57:36" nodeName="Pro + FX SS" urlName="pro+fxss" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4802"><data alias="largeImage">/media/723373/pro+fx.jpg</data><data alias="thumbnailImage">/media/723374/pro+fx.jpg</data><data alias="slideOverlayText">Professional + FX 90 Dual Fuel in Stainless Steel</data><data alias="show" /></node><node id="4805" version="3bf6786e-8dcc-425b-94e2-0bd4f20908d2" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="13" createDate="2011-07-20T11:02:55" updateDate="2011-07-20T11:02:55" nodeName="Pro + 110 SS" urlName="pro+110ss" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4805"><data alias="largeImage">/media/723382/rangemaster-pro+-rscrop.jpg</data><data alias="thumbnailImage">/media/723383/rangemaster-pro+-rscrop.jpg</data><data alias="slideOverlayText">Professional + 110 in Stainless Steel with Rangemaster 110 Flat Hood and 110 Splashback </data><data alias="show" /></node><node id="4807" version="7f588bf2-e477-4d0b-8bc4-c43aab9747ee" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="14" createDate="2011-07-20T11:15:20" updateDate="2011-07-20T11:15:20" nodeName="Cubix G Sink" urlName="cubixgsink" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4807"><data alias="largeImage">/media/723390/sink.jpg</data><data alias="thumbnailImage">/media/723391/sink.jpg</data><data alias="slideOverlayText">Rangemaster Cubix Gemini 1 1/2 bowl sink in Neostone Granite Black with a Crucifrom tap in a Brushed finish</data><data alias="show" /></node><node id="4808" version="56ad231c-f26f-4e3d-8aff-3d24de8f7f3f" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="15" createDate="2011-07-20T11:17:28" updateDate="2011-07-20T11:17:28" nodeName="Toledo 110 Black" urlName="toledo110black" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4808"><data alias="largeImage">/media/723394/toledo-110-metro_new.jpg</data><data alias="thumbnailImage">/media/723395/toledo-110-metro_new.jpg</data><data alias="slideOverlayText">Toledo 110 Induction in Black in a modern kitchen</data><data alias="show" /></node><node id="4809" version="4f2fef8a-88c3-4387-9f42-18e17a756199" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="16" createDate="2011-07-20T11:22:43" updateDate="2011-07-20T11:22:43" nodeName="Toledo 110 SS" urlName="toledo110ss" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4809"><data alias="largeImage">/media/723398/toledo-fs-hero.jpg</data><data alias="thumbnailImage">/media/723399/toledo-fs-hero.jpg</data><data alias="slideOverlayText">Toledo 110 in Stainless Steel in a large contemporary kitchen</data><data alias="show" /></node><node id="4810" version="3da04b65-6ef7-457f-b3ac-9064f84dccdc" parentID="4768" level="3" writerID="10" nodeType="4122" template="0" sortOrder="17" createDate="2011-07-20T11:24:05" updateDate="2011-07-20T11:24:05" nodeName="Toledo 110 SS 2" urlName="toledo110ss2" writerName="Francesca" nodeTypeAlias="GalleryImage" path="-1,4767,4768,4810"><data alias="largeImage">/media/723402/toledo-xt.jpg</data><data alias="thumbnailImage">/media/723403/toledo-xt.jpg</data><data alias="slideOverlayText">Toledo 110 Induction in Stainless Steel featured in a kitchen setting</data><data alias="show" /></node></node>
Thanks,
Rachel
Ok, so this should do the trick:
Awesome guys - that's done the trick! Thank you both for your help ;)
is working on a reply...