Using the standard substring(string, int, int)
function won't get you very far because I expect that the length of the document library name is unknown.
However, there are two functions that you can use in concert, substring-after(string, string)
and substring-before(string, string)
. As long as your site names aren't "Forms", you can retrieve a partial string using substring-before([URL], "/Forms")
. For the rest... it'll still be troublesome if you don't have immediate access to the site's name, but even removing that option it's still much easier than complex calculations in URL length. You'd basically have to continually perform substring-after([string], "/")
until you pop off the last slash.