Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

testxslt.xsl 2.0KB

1 year ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <!-- include in the xsl:stylesheet element:
  2. (a) the version attribute as usual
  3. (b) the XSLT namespace declaration as usual
  4. (c) the MSXSL namespace declaration
  5. (d) a namespace declaration to identify your functions
  6. (e) the 'extension-element-prefixes' attribute to give the
  7. namespace prefixes that indicate extension elements
  8. (i.e. 'msxsl')
  9. (f) the 'exclude-result-prefixes' attribute to indicate the
  10. namespaces that aren't supposed to be part of the result
  11. tree (i.e. 'foo') -->
  12. <xsl:stylesheet version="1.0"
  13. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  14. xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  15. xmlns:foo="http://www.pythoncom-test.com/foo"
  16. xmlns:bar="http://www.pythoncom-test.com/bar"
  17. extension-element-prefixes="msxsl"
  18. exclude-result-prefixes="foo bar">
  19. <!-- do whatever output you want - you can use full XSLT functionality
  20. -->
  21. <xsl:output method="html" />
  22. <!-- define the Javascript functions that you want to include within
  23. a msxsl:script element.
  24. - language indicates the scripting language
  25. - implements-prefix gives the namespace prefix that you declared
  26. for your function (i.e. foo) -->
  27. <msxsl:script language="javascript"
  28. implements-prefix="foo">
  29. function worked() {
  30. return "The jscript test worked";
  31. }
  32. </msxsl:script>
  33. <!-- ditto for Python, using the 'bar' namespace
  34. -->
  35. <msxsl:script language="python"
  36. implements-prefix="bar">
  37. def worked():
  38. return "The Python test worked"
  39. </msxsl:script>
  40. <xsl:template match="/">
  41. <!-- The output template. Keep whitespace down as our test matches text exactly -->
  42. <!-- call your functions using the prefix that you've used (i.e.
  43. foo) anywhere you can normally use an XPath function, but
  44. make sure it's returning the right kind of object -->
  45. <xsl:value-of select="foo:worked()" />.
  46. <xsl:value-of select="bar:worked()" />
  47. </xsl:template>
  48. </xsl:stylesheet>