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)
I tried converting to a number (<xsl:value-of
select="umbraco.library:GetMedia(number($currentPage/data[@alias='companyLogo']),
'false')/data [@alias = 'umbracoFile']"/> ) , that didnt work. THe companyLogo property is a Media Picker type.
I am begining to think its the document type - idb_Testimonials is the parent, idb_Testimonial is the child - I am looping and companyLogo is part of the child type. Is my /node select incorrect?
Any idea of what is wrong with this and is there a better way to debug XSLT
<?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"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:for-each select="$currentPage/ancestor-or-self::node//node [@nodeTypeAlias ='idb_Testimonials']/node ">
<xsl:if test="position() = 1">
<div class="featured_product">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia($currentPage/data[@alias='companyLogo'], 'false')/data [@alias = 'umbracoFile']"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="@nodeName"/>
</xsl:attribute>
</xsl:element>
<div class="featured_pro_details">
<span class="section_title">Featured Customer</span>
<h2>
<xsl:value-of select="@nodeName"/>
</h2>
<p>
<xsl:value-of select="$currentPage/data [@alias = 'bodyText']"/>
</p>
<xsl:if test="$currentPage/data [@alias = 'downloadUrl'] !=''">
<div class="link_btn">
<a href="{$currentPage/data [@alias ='downloadUrl']}">
<span> </span>View Testimonial
</a>
</div>
</xsl:if>
<div>
<xsl:attribute name="class">clearfix</xsl:attribute>
</div>
</div>
</div>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Throws an error...
Barry,
Cool huh, an error? what error? can you get us an error description please?
Cheers,
/Dirk
If you disable testing, save and it works anyway it's probably a getmedia thing.
http://our.umbraco.org/forum/using/ui-questions/4685-umbracoLibraryGetMedia%28%29-Problem?p=0#comment16882
A little more info would help though...
Error parsing XSLT file: \xslt\idb_FeaturedTestimonial.xslt
So, not a great error. I can save it (if I click the "ignore the errors, I know what I'm doing button") but I get that message.
So, not a great error. I can save it (if I click the "ignore the errors, I know what I'm doing button") but I get that message.
Try adding
?umbdebugshowtrace=true
on the end of your page url
Dan
I have the same guess/suspicion as Dan, the GetMedia call looks to be the culprit!
Either the 'companyLogo' property isn't a numeric - try casting it as a number().
... or the GetMedia isn't returning a node ... which means that trying to access the 'umbracoFile' property will fail too!
It would be better to assign the GetMedia to a variable, then check if it has the 'umbracoFile' property... like so:
Hope that helps?
Cheers, Lee.
The problem I am getting is on this line:
<xsl:value-of select="umbraco.library:GetMedia($currentPage/data[@alias='companyLogo'], 'false')/data [@alias = 'umbracoFile']"/>
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)
I tried converting to a number (<xsl:value-of select="umbraco.library:GetMedia(number($currentPage/data[@alias='companyLogo']), 'false')/data [@alias = 'umbracoFile']"/> ) , that didnt work. THe companyLogo property is a Media Picker type.
I am begining to think its the document type - idb_Testimonials is the parent, idb_Testimonial is the child - I am looping and companyLogo is part of the child type. Is my /node select incorrect?
In other words, the properties I am expecting are no available in my for-each
That would certainly cause the error. As for your for-each
Should do the what you're after. The // means all descendants so the ancestor-or-self part is spurious.
You could also try taking out the getMedia and just printing
to see if you've got the correct node IDs before you pass it in to getMedia.
Dan
ok, getting there.. the problem was I had $currentPage\data.. when it should have been just data.
is working on a reply...