Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello, I am trying to get a list of images from a list of ID's, here is what I go so far;
<?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" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch" xmlns:Culture="urn:Culture" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets PS.XSLTsearch Culture "><xsl:output method="xml" omit-xml-declaration="yes" /><xsl:param name="idList" /><xsl:template match="/"> <!-- First we check that the media idList is not empty --> <xsl:if test="$idList"> <ul> <xsl:for-each select="$idList/value"> <xsl:variable name="id" select="umbraco.library:GetMedia(., false())" /> <li> <!-- Output the URL using umbraco.library's NiceUrl method --> <img src="{$id/umbracoFile}" alt="{$id/@nodeName}" border="0" title="{$id/imageText//value[lang(Culture:GetName())]}" /> </li> </xsl:for-each> </ul> </xsl:if></xsl:template></xsl:stylesheet>
Sadly the code does not work at all, I simply want to get a list of the images from an array of media ids, what am I doing wrong here?
Hi Joachim
Is the ID coming from a rich text editor macro? And what version of Umbraco are you using? I'm asking since it matters in regards to wether the old legacy XML schema is being used or if it's the newest one introduced in Umbraco 4.5.
If you just write <xsl:copy-of select="$idList" /> what does it then return?
/Jan
Hi,
Maybe this forum thread can help. It first gets ID's from images in a folder, and afterwards it list them in html.
http://our.umbraco.org/forum/developers/xslt/57553-List-images-in-a-folder-fails
Robin
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Problems getting a list of images from a list of media ID's
Hello, I am trying to get a list of images from a list of ID's, here is what I go so far;
<?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" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch" xmlns:Culture="urn:Culture"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets PS.XSLTsearch Culture ">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="idList" />
<xsl:template match="/">
<!-- First we check that the media idList is not empty -->
<xsl:if test="$idList">
<ul>
<xsl:for-each select="$idList/value">
<xsl:variable name="id" select="umbraco.library:GetMedia(., false())" />
<li>
<!-- Output the URL using umbraco.library's NiceUrl method -->
<img src="{$id/umbracoFile}" alt="{$id/@nodeName}" border="0" title="{$id/imageText//value[lang(Culture:GetName())]}" />
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Sadly the code does not work at all, I simply want to get a list of the images from an array of media ids, what am I doing wrong here?
Hi Joachim
Is the ID coming from a rich text editor macro? And what version of Umbraco are you using? I'm asking since it matters in regards to wether the old legacy XML schema is being used or if it's the newest one introduced in Umbraco 4.5.
If you just write what does it then return?
/Jan
Hi,
Maybe this forum thread can help. It first gets ID's from images in a folder, and afterwards it list them in html.
http://our.umbraco.org/forum/developers/xslt/57553-List-images-in-a-folder-fails
Robin
is working on a reply...