I have a page which has URL structure : http://www.abc.com/xyz?parama=1¶mb=2
Is is possible to create a generic method for getting the values of any additional params the URL maybe (parama=1¶mb=2)
Is is possible to get the URL of the page in XSL similar to javascript's location.href ?
This might be possible using EXSLT, or registering a function callback with your particular xslt processor, but not with plain old XSLT, at least not to my knowledge. With plain XSLT, if it isn't in the XML, then it doesn't exist.
Not exactly in the same way, but yes, the query string can be passed as a parameter.
Yes, one can perform tokenization (with the
tokenize()
function in XSLT 2.0 or in XSLT 1.0 using thestr-split-to-words
template of **FXSL 1.x or a self-written recursive tokenization template.)XSLT 1.0 solution:
when the above transformation is applied on any XML document (will not be used), the wanted result is produced:
Do note the use of the FXSL 1.x
str-split-to-words
template and the use of the EXSLText:node-set()
extension function.XSLT 2.0 solution:
When the above XSLT 2.0 transformation is performed, it produces the correct result:
If it is client side, there isn't any way of doing this. Unfortunately, xsl is very limited in the browser. I'm afraid you will need to move the functionality to the webapp or to javascript.
If the transform is server side, there might be something you can do.
I workaround this by using javascript in mi XSLT file. take a look.
on The XML I have a tag element named tag! yes, very original...
Mi Sample transform
Now inside the template of the transform, in going to load my custom value in Param1 in this case i'm going to use the document.title.. by using a jquery function.