The reason for the error in the back-office XSLT editor is down to NiceUrl is expecting an integer value ... but due to the way "$parentNodeSet" is set, the parser can not be sure what type the value is - and assumes that it is a string value.
There are 2 ways around it.
1. Put the value in a number() function - to cast/convert it to an integer:
NiceUrl Syntax error
hello,
i'm try to use in my sub-navigation xslt macro the following code, that cause error:
the second line cause: "System.OverflowException: Value was either too large or too small for an Int32."
its just a matter of wrong syntax. what is the right syntax?
Thanks!
guys anyone?.. i tried few options without resolts..
thanks
Hi Eran,
Off the top of my head I'd say you're missing a "node" in the argument to NiceUrl, as your variable holds a set of nodes:
/Chriztian
Hi Eran,
Try dumping out the contents of "rootTextpageNode", see what's in there.
The exception from NiceUrl is due to the input value not being an integer ... so lets see what value you are passing to it.
Cheers, Lee.
I tried you example and it works if you set the value of the variable with the first item and then use the variable.
thanks for your help but still it's not working. i'm attaching the full XSLT:
the problematic line thta generates error is bolded:
by the way, the logic is to display a sub-menu that includes also the root parent. for example, is my content tree is look like:
Home
-- About
-- Our Team
-- Our Philosophy
and a user click on about, he will a sub-menu that looks like:
About
Our Team
Our Philosophy
Thanks!
What does it displays If you change to ? An integer, an empty string ?
<a href="{$parentNode/@id}">
when i change it to:
it outpu the nodeid
I used you code and the error appears when the parentNode is null.
So, if you put an if before the link, it works fine:
<xsl:if test="$parentNode != ''">
<a href="{umbraco.library:NiceUrl($parentNode/@id)}">
<span>
<xsl:value-of select="$parentNodeSet/data[@alias='contentPageTitle']/text()"/>
<xsl:if test="string($parentNodeSet/data[@alias='contentPageTitle']/text()) = ''">
<xsl:value-of select="$parentNodeSet/@nodeName"/>
</xsl:if>
</span>
</a>
</xsl:if>
the problem is not null, the problem that :
when i write:
it generate error, and when i write:
it only output the node id (instead of the url of the node id).
thanks.
should generate the node id. I don't understand why you wrote "(instead of the url of the node id)."
I tried your xslt code and for me it works if the current node has level 2.
If level is 1 or 3, the id is empty and the NiceUrl function is called with an empty parameter, which causes the error.
I'm sorry I can't help you more.
i wrote "instead of the url of the node id" because i mean that i dont need the nodeID - i need the url -->
because that i try to use the NiceUrl function --> that cause the error --> and because that i wrote this post..
appreciate your help.
Eran
does it also error in the frontend when you hit the checkbox to ignore errors and save?
o.k, thanks to Gerty Engrie, the problem is solved: the trick is to mark the ignore errors at the edit xsl pabel (in backend).
i will be happy to understand why this line cousing parsing error, but for now, this is full xslt that working in frontend:
the problematic line is bolded.
thanks for all the help.
Eran.
The reason for the error in the back-office XSLT editor is down to NiceUrl is expecting an integer value ... but due to the way "$parentNodeSet" is set, the parser can not be sure what type the value is - and assumes that it is a string value.
There are 2 ways around it.
1. Put the value in a number() function - to cast/convert it to an integer:
2. Wrap an <xsl:if> condition around the link, so if the value is empty it wont render. The parser then ignores the error.
Cheers, Lee.
Lee: Thanks for the info. i tried both solution:
1. the first didn't work (with the number wrap function) - stil generates parsing error.
2. the second (with the if wrapper) - works like a charm - without parsing error.
thanks.
Eran.
is working on a reply...