Hello,
I'm trying to list all images in a folder and it is really driving me crazy. Hope someone of you can help.
I want to list all images in a folder, the folder should be chosen when inserting the Macro (so not defined in a document type, that's something that I got working but not what I'm looking for). So far so good: I created a macro with an xslt and added a parameter 'mediaFolder' with type 'mediaCurrent'. When inserting the Macro I can select the folder. Nice.
In my XSLT I have the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<!-- This is our Macro Paramater with the alias of mediaFolder -->
<xsl:param name="mediaFolder" select="/macro/mediaFolder" />
<!-- The value of mediaFolder is an XML snippet, where we need to select the id attribute from the XML node <node> -->
<xsl:param name="mediaFolderID" select="$mediaFolder/node/@id" />
<xsl:template match="/">
<!-- start writing XSLT -->
<xsl:if test="$mediaFolder > 0">
<p>Yipee</p>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
But in never get the 'Yipee' ! Somebody who can explain this?
Is use Umbraco V4.11.3
I found this tutorial which I try to follow: http://our.umbraco.org/wiki/reference/code-snippets/listfilesfrommediafolderxslt
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/57553-list-images-in-a-folder-fails