Maybe you should tell what's wrong.
Syntax is ok, just not sure what you're trying to achieve.
I'm quite sure you won't find a node with id = 1, so output of this xslt snipped will be blank!
If you wish to receive an answer, give us some more info on:
-Context (where would you like to use this)
-Purpose (why do you want to have nice url for node with id = 1...)
I need to call NiceUrl with a parameter passed to my macro. If I write simply [code][/code] it's OK,
but if I try [code][/code] I see a red rectangle with stack trace.
(Reason: the parameters passed in don't have a value until runtime, and calling NiceUrl with a number that gets converted from an empty string results in an OverflowException, which is probably the exception message you've received in the 'red rectangle')
I reckon Dirk's solution as the best one but you could also just have checked the "skip error testing" box :)
But then you would have to remember to do that every time you make modifications to the xslt of course. And it could be hard to discover actual errors that has nothing to do with the nirceUrl. But I just thought you should know about the possibility to skip error testing since it can sometimes be usefull during development.
NiceUrl problem
Can anybody tell me what's wrong with this:
[code]
[/code]
Hi,
Maybe you should tell what's wrong.
Syntax is ok, just not sure what you're trying to achieve.
I'm quite sure you won't find a node with id = 1, so output of this xslt snipped will be blank!
If you wish to receive an answer, give us some more info on:
-Context (where would you like to use this)
-Purpose (why do you want to have nice url for node with id = 1...)
Looking forward to your answers!
Cheers,
/Dirk
Hi Dirk,
I need to call NiceUrl with a parameter passed to my macro. If I write simply [code][/code] it's OK,
but if I try [code][/code] I see a red rectangle with stack trace.
Hi,
allright, get the point now.
must surround the
[code]
[/code]
with an xslt:if statement
[code][/code]
(Reason: the parameters passed in don't have a value until runtime, and calling NiceUrl with a number that gets converted from an empty string results in an OverflowException, which is probably the exception message you've received in the 'red rectangle')
Hope this helps.
Regards,
/Dirk
Yes, that was it! You saved my day, thank you =d>
I reckon Dirk's solution as the best one but you could also just have checked the "skip error testing" box :)
But then you would have to remember to do that every time you make modifications to the xslt of course. And it could be hard to discover actual errors that has nothing to do with the nirceUrl. But I just thought you should know about the possibility to skip error testing since it can sometimes be usefull during development.
In umbraco version 4.0.2.1 you have to use the hack for
umbraco.library:NiceUrl(int id)
but it is not required for
umbraco.library:GetXmlNodeById(string id)
Both expect a parameter that should be a number. GetXmlNodeById doesn't require a test on the parameter before calling.
I'd like to see NiceUrl take a string parameter to avoid the extra check but I don't know what side effects this might have.
is working on a reply...