I want to reteive all images from the subpages to the current page (where i amn executing the script) and need a little push to get the looping right....
This is my code
<!-- The fun starts here -->
<div class=List">
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
Nope: that change threw multiple red lines when I tried to save the file
System.Xml.Xsl.XslLoadException: Expression must evaluate to a node-set. ...raco.library:GetMedia($mediaId, -->0<-- /umbracoFile) An error occurred at d:\web\localuser\levendelandsby.dk\public_html\xslt\634881771518785310_temp.xslt(29,9). at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver) at System.Xml.Xsl.XslCompiledTransform.Load(XmlReader stylesheet, XsltSettings settings, XmlResolver stylesheetResolver) at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)
...when i tried with ................. <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId,0)" />
When you're inside a for-each, XPath expressions are relative to the context node, so "billede" will refer to the subpage currently processed (your original used $currentPage everytime).
Xslt loop
I want to reteive all images from the subpages to the current page (where i amn executing the script) and need a little push to get the looping right....
This is my code
<!-- The fun starts here -->
<div class=List">
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
<h3 class="headline"> <a href="{umbraco.library:NiceUrl(@id)}">
<xsl:variable name="mediaId" select="number($currentPage/node()/billede)" />
<xsl:if test="$mediaId > 0">
<xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
<xsl:if test="$mediaNode/umbracoFile">
<img src="{$mediaNode/umbracoFile}" alt="[image]" height="{umbracoHeight}" width="{umbracoWidth}" />
</xsl:if>
</a>
</h3>
=====================
The image I want is stored in a Mediapicker namned = "billede"
This gives me an indentical list with the images stored in the mediapicker on the first subpage/node + a link to the subpage
What I want I is a list of all images found on subpages + the link to the subpage where image is located.
A piece of cake I suppose but it seems that I canĀ“t cut it right now.
Any hints appreciated !
/Poul
(umbraco v 4.9.0 (Assembly version: 1.0.4633.18696))
Hi Poul,
I will try to help you, if I can.
I have take a look on your XSLT code and the only line that I can see a possible mistake, is the line below.
It seems that you have mixed the new and the old XML schema.
Try this, and see if it solve your problem. I hope so.
/Dennis
Hi Dennis
Thx for the answer .... Unfortunately it does not seem to work - no image is returned. I still suspect my missing looping skils to cause the problem.
:-) Poul
Okay Poul.
Perhaps the problem could be that you have umbracoFile,
Maybe try this one and see that it works. I have not tested myself.
<xsl:iftest="$mediaId > 0">
<xsl:variablename="mediaNode"select="umbraco.library:GetMedia($mediaId, 0/umbracoFile)"/>
<xsl:iftest="$mediaNode!=''">
<imgsrc="{$mediaNode}"alt="[image]"height="{umbracoHeight}"width="{umbracoWidth}"/>
</xsl:if>
I will try to help the best I can.
/Dennis
Nope: that change threw multiple red lines when I tried to save the file
System.Xml.Xsl.XslLoadException: Expression must evaluate to a node-set.
...raco.library:GetMedia($mediaId, -->0<-- /umbracoFile) An error occurred at d:\web\localuser\levendelandsby.dk\public_html\xslt\634881771518785310_temp.xslt(29,9).
at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
at System.Xml.Xsl.XslCompiledTransform.Load(XmlReader stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)
...when i tried with ................. <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId,0)" />
I still get a repeating image....!
/Poul
Hi Poul,
Here's a fixed version of your original code (I've tried to highlight the important changes):
/Chriztian
Hi Chriztian - thx a lot.
I will need to explore thar one. The fixed code does exacltly what I want it to do.
I was not aware of "normalize-space" - quite usefull I can see.
:-))) Poul
is working on a reply...