Xslt error can be ignored, but it's best practice to surround the
[code][/code]
with an if statement.
(For each save, the xslt is checked/compiled against a node, which will probably not have that property defined, resulting in an invalid GetMedia() call)
Secondly, to get the filename of the image, change to:
Sorry to but in here guys.
But is it something as simple as that you need to change $currentPage to current() in your xsl:for-each loop? Otherwise for each of the items you will be looping out the same image for each of the nodes found in $currentPage/node [string(data [@alias='umbracoNaviHide']) != '1']
Basically says, in the current node's children select the node with an alias of providerLogo (the field that contains the ID of the media that has been selected as part of the 'page' creation). In the node, get me the node of type data where the alias is 'umbracoFile' (ie. the path to the file mathching the ID in the previous statement). Change the 'providerLogo' with the name of your document type attribute and you should be good to go.
I added to my document type a property called 'pageThumb' and I'm using the following code (note, I know it's not correct, but this way I hoped to see at least the path to the image, but no results :()
display list of images from child pages
Hi,
I am trying to display list of images on a base page..
the images have to come from the child pages.
each child page has an property by the name of providerLogo and alias providerLogo
and the type of this property is Media Picker
I am trying the following XLST on the base page. (Parent page)
I am getting the correctly
but when in try to put the code to get images.. this give me XSLT parsing error
System.OverflowException: Value was either too large or too small for an Int32.
at System.Convert.ToInt32(Double value)
at System.Double.System.IConvertible.ToInt32(IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(XmlQueryType xmlType, Object value, Type destinationType)
at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)
at (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter)
at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)
at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, TextWriter results)
at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results)
at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)
kinldy help
Ayyaz
Hi,
Xslt error can be ignored, but it's best practice to surround the
[code][/code]
with an if statement.
(For each save, the xslt is checked/compiled against a node, which will probably not have that property defined, resulting in an invalid GetMedia() call)
Secondly, to get the filename of the image, change to:
[code][/code]
to get the filename rather than the id.
Hope this helps.
Regards,
/Dirk
Thanks for the help... but it didn't work..
can you suggest to try any thing else?
Best regards,
Ayyaz Ahmed
Thanks for the help... but it didn't work..
can you suggest to try any thing else?
Best regards,
Ayyaz Ahmed
And what's the output from:
[code][/code]
/Dirk
it returns the ID of the image file in the media
in fact
-->
this returns the ID of the image file in the media
Sorry to but in here guys.
But is it something as simple as that you need to change $currentPage to current() in your xsl:for-each loop? Otherwise for each of the items you will be looping out the same image for each of the nodes found in $currentPage/node [string(data [@alias='umbracoNaviHide']) != '1']
For example
[code][/code]
This maybe of help, I am not sure.
Warren :)
thanks for the help..
i got the following working
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 ">
Best regards,
Ayyaz Ahmed
Yep glad you got it solved.
For anyone who is reading this post in the future using the following are all the same:
[code]
[/code]
[code]
[/code]
[code]
[/code]
I hope that helps out anyone who uses this post as a point of reference.
Warren :)
I can not see the OP's initial code, and also want to display thumbnails of the pages below the current page.
Obviously I used the macro template 'List subpages as thumbnails', but I miss the pictures.
Where do I insert the pictures? As a property on the documents? Alias name?
Bit confused as the xslt code is not clear to me.
Thanks!
Hi SiKo279,
the following:
umbraco.library:GetMedia(./data[@alias='providerLogo'], 'false')/data[@alias = 'umbracoFile']
Basically says, in the current node's children select the node with an alias of providerLogo (the field that contains the ID of the media that has been selected as part of the 'page' creation). In the node, get me the node of type data where the alias is 'umbracoFile' (ie. the path to the file mathching the ID in the previous statement). Change the 'providerLogo' with the name of your document type attribute and you should be good to go.
Hope this helps.
-- Nik
Thank you for explaining that part of the puzzle!
I still don't have my xslt displaying a picture.
I added to my document type a property called 'pageThumb' and I'm using the following code (note, I know it's not correct, but this way I hoped to see at least the path to the image, but no results :()
<xsl:template match="/">
<!-- The fun starts here -->
<!-- [string(data [@alias='umbracoNaviHide']) != '1'] -->
<xsl:for-each select="$currentPage/node ">
<div style="text-align: center; width: 150px; height: 125px; float: left; border: 1px solid #999; background-color: #EDEDED; padding: 5px; margin: 10px;" onMouseOver="this.style.backgroundColor='CCC';" onMouseOut="this.style.backgroundColor='#EDEDED';">
<!-- get first photo thumbnail -->
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:if test="count(./node) > 0">
<xsl:value-of select="umbraco.library:GetMedia(data[@alias='pageThumb'], 'false')/data[@alias = 'umbracoFile']"/>
<img src="" style="border: none;"/><br/>
</xsl:if>
<b><xsl:value-of select="@nodeName"/></b><br/>
</a>
<xsl:value-of select="count(./node)"/> Photo(s)
</div>
</xsl:for-each>
</xsl:template>
(or, just a test, as we cannot edit messages yet)
[code]
<xsl:template match="/">
<!-- The fun starts here -->
<!-- [string(data [@alias='umbracoNaviHide']) != '1'] -->
<xsl:for-each select="$currentPage/node ">
<div style="text-align: center; width: 150px; height: 125px; float: left; border: 1px solid #999; background-color: #EDEDED; padding: 5px; margin: 10px;" onMouseOver="this.style.backgroundColor='CCC';" onMouseOut="this.style.backgroundColor='#EDEDED';">
<!-- get first photo thumbnail -->
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:if test="count(./node) > 0">
<xsl:value-of select="umbraco.library:GetMedia(data[@alias='pageThumb'], 'false')/data[@alias = 'umbracoFile']"/>
<img src="" style="border: none;"/><br/>
</xsl:if>
<b><xsl:value-of select="@nodeName"/></b><br/>
</a>
<xsl:value-of select="count(./node)"/> Photo(s)
</div>
</xsl:for-each>
</xsl:template>
[/code]
Ok, I found the solution:
<xsl:template match="/">
<!-- The fun starts here -->
<!-- [string(data [@alias='umbracoNaviHide']) != '1'] -->
<xsl:for-each select="$currentPage/node ">
<div style="text-align: center; width: 150px; height: 125px; float: left; border: 1px solid #999; background-color: #EDEDED; padding: 5px; margin: 10px;" onMouseOver="this.style.backgroundColor='CCC';" onMouseOut="this.style.backgroundColor='#EDEDED';">
<!-- get first photo thumbnail -->
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:if test="string(data [@alias='pageThumb'])">
<img style="border: none;">
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia(data [@alias = 'pageThumb'], 'false')/data [@alias = 'umbracoFile']"/>
</xsl:attribute>
</img>
<br/>
</xsl:if>
<b>
<xsl:value-of select="@nodeName"/>
</b>
<br />
<br />
</a>
<xsl:value-of select="count(./node)"/> Photo(s)
</div>
</xsl:for-each>
</xsl:template>
is working on a reply...