Not sure what I'm doing wrong here. I have a for-each loop and some Choose logic in the parent template. The parent template calls this template and passes a node. I'm able to loop through the list of children in the param node that is being passed in and I'm able to get the children @Id and @nodeName....but all the following variations of NiceRUrl give me the following exeption.
System.OverflowException: Value was either too large or too small for an Int32.
For the record: The first is the one that you should use (the other two does the exact same thing with bigger byte-counts :-)
If you're on 4.5.1 (which I suspect), you should add the [@isDoc] predicate to the $parent/* select, like this:
<xsl:for-each select="$parent/*[@isDoc]">
because the star will select all the properties as well...
Why does the value-of statements "work"?
- Because they will print the @id and @nodeName from the document node, and nothing from the properties - the properties on the other hand will fail in the NiceUrl() call because they have no @id attribute...
@Chriztian - Yes I am using 4.5.1. Thank you for the explanation, that does work. I didn't realize that [@isDoc] predicate included the properties. Great information!
for-each loop and NiceURL in a template
Not sure what I'm doing wrong here. I have a for-each loop and some Choose logic in the parent template. The parent template calls this template and passes a node. I'm able to loop through the list of children in the param node that is being passed in and I'm able to get the children @Id and @nodeName....but all the following variations of NiceRUrl give me the following exeption.
System.OverflowException: Value was either too large or too small for an Int32.
<xsl:template name="DropLineNonActive">
<xsl:param name="parent"/>
<ul class="sub">
<xsl:for-each select="$parent/*">
<li>
<a href="{umbraco.library:NiceUrl(@id)}"></a> <!--tried this, throws error-->
<a href="{umbraco.library:NiceUrl(./@id)}"></a> <!--tried this, throws error-->
<a href="{umbraco.library:NiceUrl(current()/@id)}"></a> <!--tried this, throws error-->
<xsl:value-of select="@id"/><!--works as expected-->
<xsl:value-of select="@nodeName"/><!--works as expected-->
</li>
</xsl:for-each>
</ul>
</xsl:template>
Not sure why this won't work. Thanks for any advise you may have.
Eric
Hi Eric,
Are you on 4.5.1 or 4.0?
For the record: The first is the one that you should use (the other two does the exact same thing with bigger byte-counts :-)
If you're on 4.5.1 (which I suspect), you should add the [@isDoc] predicate to the $parent/* select, like this:
because the star will select all the properties as well...
Why does the value-of statements "work"?
- Because they will print the @id and @nodeName from the document node, and nothing from the properties - the properties on the other hand will fail in the NiceUrl() call because they have no @id attribute...
/Chriztian
@Chriztian - Yes I am using 4.5.1. Thank you for the explanation, that does work. I didn't realize that [@isDoc] predicate included the properties. Great information!
Thanks
Eric
is working on a reply...