I'm pretty sure that in a template function like that you don't have access to other template functions. I think you will need to use Python functions to do this.
I think the following will work:
Code:
val[i] = '/'.join(v.split('/').sort())
But, I haven't tested it.