I'm writing some xlst file which I want to use under linux and Windows. In this file I use node-set function which declared in different namespaces for MSXML and xsltproc ("urn:schemas-microsoft-com:xslt" and "http://exslt.org/common" respectively). Is there any platform independent way of using node-set?
相关问题
- Illegal to have multiple roots (start tag in epilo
- Newtonsoft DeserializeXNode expands internal array
- how to use special characters like '<'
- XML - XSLT - document() function inside count() fu
- convert logback.xml to log4j.properties
相关文章
- Creating XML Elements without namespace declaratio
- Get Attribute Value From Simple XML Using JQuery /
- How do you make an installer for your python progr
- Libgdx - Check if a key is being held down?
- Is there a non-java, cross platform way to launch
- How to get a settings storage path in a cross-plat
- Directly signing an Office Word document using XML
- When sending XML to JMS should I use TextMessage o
Yes, there is a good and universal solution.
EXSLT's function common:node-set() can be implemented as an inline Javascript function and is thus available with any browser that supports Javascript (practically all major browsers without exception).
This technique was first discovered by Julian Reschke and after he published it on the xsl-list, was publicized by David Carlisle. On the blog of David Carlisle there is also a link to a test page that shows if the common:node-set() function thus implemented works with the browser of your choice.
To summarize:
Do enjoy!
If there is not a particular reason to use msxml implementation of node-set on windows you coul use exslt one everywhere, by including the implemenation downloaded from http://exslt.org with your stylesheet, exslt howto describes the needed steps. You can use either "Extension namespaces" way or "Named templates" way.
Exslt is "supposed to be" a platform-independent set of xslt extensions, but only so far as various xslt processors choose to implement them.
There's some evidence that MSXML actually does support exsl:node-set(), but I don't know for sure.
There is an old article discussing an implementation of exslt on top of MSXML.
Otherwise, I think function-available() is your friend :)
You can use the function function-available() to determine which function you should use:
You can even wrap this logic in a named template and call it with the nodeset as a parameter.
Firefox 3 implements node-set (as part of the EXSLT 2.0 namespace improvements) in it's client-side XSLT processing.
Maybe not quite the answer you were looking for - but it could be, depending on the context of your problem. ;-)