Is there a way to retreive the values from Token at page XSL level and then do operations to that value?
No, there isn't. As you correctly surmised, those tokens are replaced only after the XSL processing, so your choices are either using an external/controller before the XSL processing, or using Javascript afterwards.
It depends on what you're looking to do. You can use a controller if you're looking to modify (rewrite) one or more page tokens, or if you want to inject stuff into the header and/or body outside of components (which is what I'm guessing you're looking for, since you're talking about the page XSL).If I'm wrong about your intent, what *are* you looking to do with it?
Can you not use the controller to edit the context information and then use $CONTEXT in the page xsl? Either that, or maybe define+populate a new $PAGE_SCOPE[] token? There are alternatives to your approach though:* If you're putting stylesheet paths in default.site and not overriding them in any page, then remove them and have your controller print them out. Not very editor-friendly, but these paths may not change often (if ever) so perhaps it's an option; or* Use workflow to "fix" the output after generation; or* Use URL internal rewrites on the front-end to direct CSS requests to where they actually live.
How can the context information be modified? i have checked the requestcontext documentation and i can see only get methods (only couple of set methods for setPageTitle, setRedirectUrl).
Also i thought about creating my own token earlier but could not find any documentation or reference which i can use. Are there any leads on that?
to create new token just do this :context.getPageScopeData().put("MyNewToken", "Value");then use $Page_Scope[MyNewToken] in your xsl.
That was a guess on my part. I haven't actually looked into using context information all that much.It's "documented" in a webcast, which is not part of the PDF distribution. Find it here (linked from here). There's a slide at the end that says you can create your own tokens (but doesn't say how, so I'm guessing you just "put" a new String key in the page scope).
This is not a new token. Its usage of Page_SCOPE token to set some variable. I want to create a Token Like PAGE_SCOPE so that i can control what it should be doing externally.
Sorry, interDev's example is exactly what I was talking about. You'd then use this in front of your CSS paths in a way similar to $URL_PREFIX. Your site-level PreController would be responsible for populating the $PAGE_SCOPE[CSSPrefix] with whatever value you've computed.If you want to create your own replacement token, I believe you can write a PostController to search+replace the generated HTML before it's sent to the user (or written to a file). I don't have a code sample for this with me, will rummage for it later.