PRMTXmlToJavascript.xslt 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!--
  3. +=========================================================================+
  4. | Licensed Materials - Property of IBM |
  5. | BI and PM: prmt |
  6. | (C) Copyright IBM Corp. 2002, 2016 |
  7. | |
  8. | US Government Users Restricted Rights - Use, duplication or |
  9. | disclosure restricted by GSA ADP Schedule Contract with IBM Corp. |
  10. | |
  11. +=========================================================================+
  12. -->
  13. <stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
  14. <output method="text" encoding="UTF-8"/>
  15. <template match="/">
  16. <text>/*&#x0a;</text>
  17. <text> *+=========================================================================+&#x0a;</text>
  18. <text> *| IBM Confidential |&#x0a;</text>
  19. <text> *| Licensed Materials - Property of IBM |&#x0a;</text>
  20. <text> *| BI and PM: prmt |&#x0a;</text>
  21. <text> *| (C) Copyright IBM Corp. 2002, 2016 |&#x0a;</text>
  22. <text> *| |&#x0a;</text>
  23. <text> *| US Government Users Restricted Rights - Use, duplication or |&#x0a;</text>
  24. <text> *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp. |&#x0a;</text>
  25. <text> *| |&#x0a;</text>
  26. <text> *+=========================================================================+&#x0a;</text>
  27. <text>*/&#x0a;</text>
  28. <for-each select="stringTable/component">
  29. <variable name="comp_name" select="@name" />
  30. <for-each select="section">
  31. <variable name="sect_name" select="@name" />
  32. <if test="$sect_name != 'STC' and $sect_name != 'DFP' and $sect_name != 'CON'">
  33. <for-each select="string">
  34. <text>var </text> <value-of select="$comp_name" />_<value-of select="$sect_name" />_<value-of select="@id" />
  35. <text> = &quot;</text>
  36. <call-template name="replaceChar">
  37. <with-param name="text">
  38. <call-template name="replaceChar">
  39. <with-param name="text" select="." />
  40. <with-param name="toReplace">\</with-param>
  41. <with-param name="replaceWith">\\</with-param>
  42. </call-template>
  43. </with-param>
  44. <with-param name="toReplace">"</with-param>
  45. <with-param name="replaceWith">\"</with-param>
  46. </call-template>
  47. <text>&quot;;&#x0a;</text>
  48. </for-each>
  49. </if>
  50. </for-each>
  51. </for-each>
  52. </template>
  53. <template name="replaceChar">
  54. <param name="text" />
  55. <param name="toReplace" />
  56. <param name="replaceWith" />
  57. <choose>
  58. <when test="contains($text, $toReplace)">
  59. <variable name="beforeChar" select="substring-before($text,$toReplace)" />
  60. <variable name="afterChar">
  61. <call-template name="replaceChar">
  62. <with-param name="text" select="substring-after($text,$toReplace)" />
  63. <with-param name="toReplace" select="$toReplace" />
  64. <with-param name="replaceWith" select="$replaceWith" />
  65. </call-template>
  66. </variable>
  67. <value-of select="concat($beforeChar, $replaceWith, $afterChar)" />
  68. </when>
  69. <otherwise>
  70. <value-of select="$text" />
  71. </otherwise>
  72. </choose>
  73. </template>
  74. </stylesheet>