System.OverflowException: Value was either too large or too small for an Int32. at System.Convert.ToInt32(Double value) 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, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current) at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer) 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)
That error usually always means that you're calling NiceUrl() with a null value (or a string like "hello") instead of an actual id.
I would guess it happens when you save the file right now, because then Umbraco will try to run the macro using the Content node as $currentPage, which will result in NiceUrl() being called with null (the parent of Content neither has an id attribute, nor a linkId property).
It could also happen if you're doing this in a for-each loop and one of the nodes you're selecting doesn't have a value in the linkId property - which will easily happen when you're testing the feature - you create the property and only save it on a single node. The other nodes doesn't get the property until they're republished somehow, and NiceUrl() will barf again.
So you should always make sure that you're actually sending an id into NiceUrl(), GetXmlNodeById() etc. - you can do that with the if instruction:
Hi Umbraco masterminds :)
I have created a documenttype with property alias linkId which contains the link to the external page. The idea was to replace
<xsl:value-of select="umbraco.library:NiceUrl($currentPage/../@id)" />
with
<xsl:value-of select="umbraco.library:NiceUrl($currentPage/linkId)" />
but it didnt work instead i get exception cause niceurl take int as param I suppose.
System.OverflowException: Value was either too large or too small for an Int32.
<a>
<xsl:attribute name="href">
<xsl:value-of select="umbraco.library:NiceUrl($currentPage/../@id)" />
</xsl:attribute>
<xsl:value-of select="$currentPage/linkId" />
</a>
Thanks
I'm going to have to guess what the question is here...
You don't use NiceUrl on external link, you just use the link given.
For a neat way of dealing with either internal or external links try http://ucomponents.org/data-types/url-picker/
Rich
Hi Hassan,
Maybe this is the same question?
http://our.umbraco.org/forum/developers/xslt/24167-Getting-value-of-External-Link.
Else I think Rich´s solution looks quite exciting.
/Dennis
Hi Dennis
Have seen that post and tried the soulution and the code looks like this:
Error occured
System.OverflowException: Value was either too large or too small for an Int32.
at System.Convert.ToInt32(Double value)
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, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
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)
How about:
<xsl:value-of select="umbraco.library:NiceUrl(number($currentPage/linkId))" />
Hi kipusoep
Still throws the same exception with
<xsl:value-of select="umbraco.library:NiceUrl(number($currentPage/linkId))" />
Hi Hassan,
That error usually always means that you're calling NiceUrl() with a null value (or a string like "hello") instead of an actual id.
I would guess it happens when you save the file right now, because then Umbraco will try to run the macro using the Content node as $currentPage, which will result in NiceUrl() being called with null (the parent of Content neither has an id attribute, nor a linkId property).
It could also happen if you're doing this in a for-each loop and one of the nodes you're selecting doesn't have a value in the linkId property - which will easily happen when you're testing the feature - you create the property and only save it on a single node. The other nodes doesn't get the property until they're republished somehow, and NiceUrl() will barf again.
So you should always make sure that you're actually sending an id into NiceUrl(), GetXmlNodeById() etc. - you can do that with the if instruction:
/Chriztian
is working on a reply...