Cross-platform scripting
What I need: An XSLT template I can run on the server OR the client (IE6 or FireFox) without any hassles.
Simple Question: Can I use a template with parameters written in XSL as a function in an XPATH query. (My suspicion is no, because I haven't been able to find a simple answer after days of searching)
If not: I know I can write an XPATH function in Javascript, but there appears to be different ways to do this in different XSLT parsers. This is incredibly frustrating because both browsers and my server-side parser support Javascript, they just embed it differently!!! Is there no cross-platform approach?
What I'm trying to do: I have a bunch of comma delimited values stored in a global parameter (ex. "Skills,Weaknesses,Names"). Each node of a certain type contains an attribute that contains a list of comma delimited values, some of which may or may not exist in the global parameter(ex. "Skills, Strengths, Languages"). I want to write an XPATH function that I can use in an XSL sort tag to sort a group of nodes based on the following criteria:
If parameters value is "Skills,Weaknesses,Names":
If the current node's attribute contains the first entry in the parameters value ("Skills"), it's position is 1.
If the current node's attribute contains the second entry in the parameters value ("Weaknesses"), it's position is 2.
If the current node's attribute contains the third entry in the parameters value ("Names"), it's position is 3.
and so on...
Please remember I need a cross-platform solution.
Thanks so much for your help.
|