node-set : Value was either too large or too small for an Int 32
The node-set function is very useful for building custom variables.
As I am new to using it, I have a basic question. I have the following variable which loops through some nodesets in the "storysTagged[#]" variable, picks ou the latest one, and then turns those results into a node-set:
<xsl:for-each select="$storysTagged1" >
<!-- sorted by date updated (latest first) -->
<xsl:sort select="@updateDate" data-type="text" order="descending" />
<!-- grab the first one's `@id` -->
<xsl:if test="position() = 1">
<nodeId><xsl:value-of select="@id" /></nodeId><tagUsed><xsl:value-of select="$storyTag1" /></tagUsed>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="$storysTagged2" >
<!-- sorted by date updated (latest first) -->
<xsl:sort select="@updateDate" data-type="text" order="descending" />
<!-- grab the first one's `@id` -->
<xsl:if test="position() = 1">
<nodeId><xsl:value-of select="@id" /></nodeId><tagUsed><xsl:value-of select="$storyTag2" /></tagUsed>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="$storysTagged3" >
<!-- sorted by date updated (latest first) -->
<xsl:sort select="@updateDate" data-type="text" order="descending" />
<!-- grab the first one's `@id` -->
<xsl:if test="position() = 1">
<nodeId><xsl:value-of select="@id" /></nodeId><tagUsed><xsl:value-of select="$storyTag3" /></tagUsed>
</xsl:if>
Next however, the need has arisen, that I need to pass more than just the nodeId in my variable, so I did this:
<xsl:variable name="latestProxy">
<!-- Loop taglists defined above, -->
<xsl:for-each select="$storysTagged1" >
<!-- sorted by date updated (latest first) -->
<xsl:sort select="@updateDate" data-type="text" order="descending" />
<!-- grab the first one's `@id` -->
<xsl:if test="position() = 1">
<nodeId><xsl:value-of select="@id" /></nodeId>
<tagUsed><xsl:value-of select="$storyTag1" /></tagUsed>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="$storysTagged2" >
<!-- sorted by date updated (latest first) -->
<xsl:sort select="@updateDate" data-type="text" order="descending" />
<!-- grab the first one's `@id` -->
<xsl:if test="position() = 1">
<nodeId><xsl:value-of select="@id" /></nodeId>
<tagUsed><xsl:value-of select="$storyTag2" /></tagUsed>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="$storysTagged3" >
<!-- sorted by date updated (latest first) -->
<xsl:sort select="@updateDate" data-type="text" order="descending" />
<!-- grab the first one's `@id` -->
<xsl:if test="position() = 1">
<nodeId><xsl:value-of select="@id" /></nodeId>
<tagUsed><xsl:value-of select="$storyTag3" /></tagUsed>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="$storysTagged4" >
<!-- sorted by date updated (latest first) -->
<xsl:sort select="@updateDate" data-type="text" order="descending" />
<!-- grab the first one's `@id` -->
<xsl:if test="position() = 1">
<nodeId><xsl:value-of select="@id" /></nodeId>
<tagUsed><xsl:value-of select="$storyTag4" /></tagUsed>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<!-- Create an XPath-navigable version of that set -->
<xsl:variable name="latest" select="make:node-set($latestProxy)" />
But I get an error:
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 (3)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
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)
This is strange because looking through the forums, I see this example:
<!-- List files to include for specific pages -->
<xsl:variable name="file-mapper">
<page id="31415">
<css>pi.css</css>
<script>math.js</script>
</page>
<page id="1984">
<css>bigbrother.css</css>
</page>
</xsl:variable>
<!-- Make XPath-navigable node-set from the above variable -->
<xsl:variable name="files" select="msxml:node-set($file-mapper)" />
..And so I'm a bit puzzled. In fact, even in the first example, when I create the node-set like this:
<!-- Create an XPath-navigable version of that set -->
<xsl:variable name="latest" select="make:node-set($latestProxy)" />
I still get the error.
Am I missing something? Why do I get the error and what do I have to do to fix it so I can build more flexible XML in variables?
The node-set function is very useful for building custom variables.
As I am new to using it, I have a basic question. I have the following
variable which loops through some nodesets in the "storysTagged[#]"
variable, picks ou the latest one, and then turns those results into
a node-set:
<xsl:variable name="latestProxy">
<!-- Loop taglists defined above, -->
<xsl:for-each select="$storysTagged1" >
<!-- sorted by date updated (latest first) -->
<xsl:sort select="@updateDate" data-type="text" order="descending" />
<!-- grab the first one's `@id` -->
<xsl:if test="position() = 1">
<nodeId><xsl:value-of select="@id" /></nodeId><tagUsed><xsl:value-of select="$storyTag1" /></tagUsed>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="$storysTagged2" >
<!-- sorted by date updated (latest first) -->
<xsl:sort select="@updateDate" data-type="text" order="descending" />
<!-- grab the first one's `@id` -->
<xsl:if test="position() = 1">
<nodeId><xsl:value-of select="@id" /></nodeId><tagUsed><xsl:value-of select="$storyTag2" /></tagUsed>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="$storysTagged3" >
<!-- sorted by date updated (latest first) -->
<xsl:sort select="@updateDate" data-type="text" order="descending" />
<!-- grab the first one's `@id` -->
<xsl:if test="position() = 1">
<nodeId><xsl:value-of select="@id" /></nodeId><tagUsed><xsl:value-of select="$storyTag3" /></tagUsed>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="$storysTagged4" >
<!-- sorted by date updated (latest first) -->
<xsl:sort select="@updateDate" data-type="text" order="descending" />
<!-- grab the first one's `@id` -->
<xsl:if test="position() = 1">
<nodeId><xsl:value-of select="@id" /></nodeId><tagUsed><xsl:value-of select="$storyTag3" /></tagUsed>
</xsl:if>
</xsl:for-each>
<!-- Create an XPath-navigable version of that set -->
<xsl:variable name="latest" select="make:node-set($latestProxy)/nodeId" />
Then I can just loop through it later, like this:
It works fine.
Next however, the need has arisen, that I need to pass more than just
the nodeId in my variable, so I did this:
<xsl:variable name="latestProxy">
<!-- Loop taglists defined above, -->
<xsl:for-each select="$storysTagged1" >
<!-- sorted by date updated (latest first) -->
<xsl:sort select="@updateDate" data-type="text" order="descending" />
<!-- grab the first one's `@id` -->
<xsl:if test="position() = 1">
<nodeId><xsl:value-of select="@id" /></nodeId>
<tagUsed><xsl:value-of select="$storyTag1" /></tagUsed>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="$storysTagged2" >
<!-- sorted by date updated (latest first) -->
<xsl:sort select="@updateDate" data-type="text" order="descending" />
<!-- grab the first one's `@id` -->
<xsl:if test="position() = 1">
<nodeId><xsl:value-of select="@id" /></nodeId>
<tagUsed><xsl:value-of select="$storyTag2" /></tagUsed>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="$storysTagged3" >
<!-- sorted by date updated (latest first) -->
<xsl:sort select="@updateDate" data-type="text" order="descending" />
<!-- grab the first one's `@id` -->
<xsl:if test="position() = 1">
<nodeId><xsl:value-of select="@id" /></nodeId>
<tagUsed><xsl:value-of select="$storyTag3" /></tagUsed>
</xsl:if>
</xsl:for-each> <xsl:for-each select="$storysTagged4" >
<!-- sorted by date updated (latest first) -->
<xsl:sort select="@updateDate" data-type="text" order="descending" />
<!-- grab the first one's `@id` -->
<xsl:if test="position() = 1">
<nodeId><xsl:value-of select="@id" /></nodeId>
<tagUsed><xsl:value-of select="$storyTag4" /></tagUsed>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<!-- Create an XPath-navigable version of that set --> <xsl:variable name="latest" select="make:node-set($latestProxy)" />
But I get an error:
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 (3)(XmlQueryRuntime
{urn:schemas-microsoft-com:xslt-debug}runtime) 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)
This is strange because looking through the forums, I see [this][1]
example:
<script>math.js</script>
..And so I'm a bit puzzled. In fact, even in the first example, when I
create the node-set like this:
I still get the error.
Am I missing something? Why do I get the error and what do I have to
do to fix it so I can build more flexible XML in variables?
I would recommend you did something like this instead:
<node tag="{$storyTag3}" id="{@id}" />
When you do the other thing, you're creating what's called mixed content (your <nodeId> contains both text - the id - and elements - <tagUsed>) which becomes tricky (as you found out).
This way you can store whatever you need from the original node.
I tried using the apply-templates approach based on the earlier example, but I ran into some problems.
I needed to get it done, so I reverted to this modified approach. I will try and detail it when I get
a chance because I really want to master that.
node-set : Value was either too large or too small for an Int 32
The node-set function is very useful for building custom variables.
As I am new to using it, I have a basic question. I have the following variable which loops through some nodesets in the "storysTagged[#]" variable, picks ou the latest one, and then turns those results into a node-set:
Then I can just loop through it later, like this:
It works fine.
Next however, the need has arisen, that I need to pass more than just the nodeId in my variable, so I did this:
But I get an error:
This is strange because looking through the forums, I see this example:
..And so I'm a bit puzzled. In fact, even in the first example, when I create the node-set like this:
I still get the error.
Am I missing something? Why do I get the error and what do I have to do to fix it so I can build more flexible XML in variables?
holy crap, this editor is driving me insane! Reposting question....
Actually, I see that my error was two-fold.
1) I need the extra items that I want to pass to be children of the existing
So for example, in my node building variable...I nest the new item I want to pass, like this:
2) When I access those items, I will need to so a little differently.
Like this:
To build my node.
And like this to get at my item:
Hi Jacob,
I would recommend you did something like this instead:
When you do the other thing, you're creating what's called mixed content (your
<nodeId>
contains both text - theid
- and elements -<tagUsed>
) which becomes tricky (as you found out).This way you can store whatever you need from the original node.
To get the values you adjust to this:
/Chriztian
Awesome thanks.
I tried using the apply-templates approach based on the earlier example, but I ran into some problems. I needed to get it done, so I reverted to this modified approach. I will try and detail it when I get a chance because I really want to master that.
is working on a reply...