The script cannot display any output and I have this error on fronted: "Error parsing XSLT file:" On backend I have this error: "Error occurred 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) [...]"
I have added the code you have indicated, but I have the same error on frontend (Error parsing XSLT file: \xslt\umbSidebarSx1.xslt) if I set the order as asc:
I've had a look at your XSLT snippet, I can't see any reason why swapping "descending" with "ascending" should cause a problem.
The error message "Error parsing XSLT file" implies that there is something structurally wrong with the XSLT. Are you still getting the "OverflowException" when saving from the back-office?
Value was either too large or too small for an Int32. 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 System.Xml.Xsl.CompiledQuery.Query.(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList`1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList`1 post) in C:\inetpub\wwwroot\xslt\umbSidebarSx1.xslt:line 66 at System.Xml.Xsl.CompiledQuery.Query.(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList`1 {urn:schemas-microsoft-com:xslt-debug}namespaces) in C:\inetpub\wwwroot\xslt\umbSidebarSx1.xslt:line 50 at System.Xml.Xsl.CompiledQuery.Query.(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator , Double , Double ) at System.Xml.Xsl.CompiledQuery.Query.Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at System.Xml.Xsl.CompiledQuery.Query.Execute(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.macro.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt, Dictionary`2 parameters) at umbraco.macro.loadMacroXSLT(macro macro, MacroModel model, Hashtable pageElements)
I don't understand... with desc work fine, with asc not.. The numbers are the same..
I think I know what it is. When you are gathering the nodes in the "Prima" and "Successive" variables, you are using "descendant::node()" - which will get all none document/content nodes too (e.g. includes property nodes). So when you (eventually) pass these nodes through to the "showSuccessive" template, some of them wont have an "id" attribute, which means NiceUrl is throwing an error.
Problem with ordering of nodes
Hello, i have a XSLT to display a sidebar a menu, but I have a big problem for sorting. I have this line:
<xsl:sort select="@sortOrder" order="descending" data-type="number"></xsl:sort>
and output work perfectly. But i want the ordering by "ascending". When I change to option to:
<xsl:sort select="@sortOrder" order="ascending" data-type="number"></xsl:sort>
The script cannot display any output and I have this error on fronted: "Error parsing XSLT file:" On backend I have this error: "Error occurred 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) [...]"
Here the complete code: http://codepaste.net/tiq668
Can you help me please?
Hi Paolo,
The issue is with the value of the "Id" variable. Since it is used with GetXmlNodeById, it must be a numeric value, but the fall-back value is "no".
You could either wrap a condition around the rest of your mark-up... to test that the value is not "no", or set it to a default value?
Put this above the "Prima" variable, and the closing </xsl:if> at the end of that template.
Cheers, Lee.
Hi Lee, thank you for your reply.
I have added the code you have indicated, but I have the same error on frontend (Error parsing XSLT file: \xslt\umbSidebarSx1.xslt) if I set the order as asc:
<xsl:sort select="@sortOrder" order="ascending" data-type="number" />
if I set the order as desc, everything is ok. I don't understand it.. can you help me?
Here the complete code:
http://codepaste.net/oioo7t
Thank you.
Up! :)
Hi Paolo,
I've had a look at your XSLT snippet, I can't see any reason why swapping "descending" with "ascending" should cause a problem.
The error message "Error parsing XSLT file" implies that there is something structurally wrong with the XSLT. Are you still getting the "OverflowException" when saving from the back-office?
- Lee
Hi Lee, no, now the issue of "OverflowException" is resolved (thank you for your tip)!
I can't see any reason why swapping "descending" with "ascending" should cause a problem, too, but I have this issue :(
Thank you, Paolo.
Can you add an
?umbDebugShowTrace=true
parameter to your URL when you get the error, and post the actually error message (highlighted in red) here?@Dan: thank you for the support.
Here the error:
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 System.Xml.Xsl.CompiledQuery.Query.(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList`1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList`1 post) in C:\inetpub\wwwroot\xslt\umbSidebarSx1.xslt:line 66
at System.Xml.Xsl.CompiledQuery.Query.(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList`1 {urn:schemas-microsoft-com:xslt-debug}namespaces) in C:\inetpub\wwwroot\xslt\umbSidebarSx1.xslt:line 50
at System.Xml.Xsl.CompiledQuery.Query.(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator , Double , Double )
at System.Xml.Xsl.CompiledQuery.Query.Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.CompiledQuery.Query.Execute(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.macro.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt, Dictionary`2 parameters)
at umbraco.macro.loadMacroXSLT(macro macro, MacroModel model, Hashtable pageElements)
I don't understand... with desc work fine, with asc not.. The numbers are the same..
Hi Paolo,
I think I know what it is. When you are gathering the nodes in the "Prima" and "Successive" variables, you are using "descendant::node()" - which will get all none document/content nodes too (e.g. includes property nodes). So when you (eventually) pass these nodes through to the "showSuccessive" template, some of them wont have an "id" attribute, which means NiceUrl is throwing an error.
Quickest fix is correcting the root cause:
Cheers, Lee.
Hi Lee, you are a guru! :) Now work perfectly :)
Thank you very very much!
Cheers, Paolo.
is working on a reply...