PROCES_INCLUDE.xsl 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  4. xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
  5. exclude-result-prefixes="xs system_cache__appinfo"
  6. version="2.0">
  7. <xsl:param name="DEFAULTS__SERVER_ADDRESS" select="'biuro.biall-net.pl/SE/version-git/'"/><!-- parametr do wyrzucenia w defaults - do umozliwienia szybkiego wchodzenia do systemu powiazania szkolenia -->
  8. <xsl:param name="CRM_PROCES.xml" required="yes"/>
  9. <!--<xsl:import href="../../default_db.instance.xml/"/>-->
  10. <xsl:include href="escaped_html_to_xml.xsl"/>
  11. <xsl:template match="text()" mode="PROCES_INCLUDE">
  12. <xsl:param name="ID_PROCES" required="yes"/><!-- to be set to retrieve process tree -->
  13. parsed PROCES:<xsl:value-of select="$ID_PROCES"/>; proces to include is <xsl:value-of select="."/>;
  14. <xsl:apply-templates mode="PROCES_TO_DITA" select="$CRM_PROCES.xml/data/items/item[ID=$ID_PROCES]"/>
  15. <xsl:apply-templates mode="CRM_PROCES_STEP" select="$CRM_PROCES.xml/data/items/item[PARENT_ID=$ID_PROCES]">
  16. <xsl:sort select="SORT_PRIO"/>
  17. </xsl:apply-templates>
  18. </xsl:template>
  19. <xsl:template mode="CRM_PROCES_STEP" match="node()">
  20. <!-- CRM_PROCES_STEP dla ID <xsl:value-of select="ID"/> ;-->
  21. <xsl:variable name="ID" select="ID"/>
  22. <ul>
  23. <xsl:for-each select=".">
  24. <xsl:sort select="SORT_PRIO"/>
  25. <li>
  26. <xsl:apply-templates mode="PROCES_TO_DITA">
  27. <xsl:with-param name="ID" select="$ID"/>
  28. </xsl:apply-templates>
  29. <!-- Try to goto item/PARENT_ID=<xsl:value-of select="current()/ID"/>-->
  30. <xsl:apply-templates mode="CRM_PROCES_STEP" select="$CRM_PROCES.xml/data/items/item[PARENT_ID=$ID and A_STATUS!='DELETED']"/>
  31. </li>
  32. </xsl:for-each>
  33. </ul>
  34. </xsl:template>
  35. <xsl:template mode="PROCES_TO_DITA" match="ID">
  36. <xref href="https://{$DEFAULTS__SERVER_ADDRESS}/procesy5.php?task=CRM_PROCES&amp;filtr_id={current()}&amp;filtr_ids=%2B&amp;filtr_ob=%2B&amp;filtr_img=%2B" format="html" scope="external"><xsl:value-of select="."/></xref>
  37. </xsl:template>
  38. <xsl:template mode="PROCES_TO_DITA" match="DESC">
  39. <xsl:param name="ID"/>
  40. <term><!--ID: <xsl:apply-templates mode="PROCES_TO_DITA_STRIP_HTML" select="../ID/text()"/><xsl:value-of select="' '"/>--> <xsl:apply-templates mode="PROCES_TO_DITA_STRIP_HTML"/></term>
  41. </xsl:template>
  42. <xsl:template mode="PROCES_TO_DITA" match="OPIS">
  43. OPIS: <xsl:apply-templates mode="PROCES_TO_DITA_STRIP_HTML"/>
  44. </xsl:template>
  45. <xsl:template mode="PROCES_TO_DITA" match="*"/>
  46. <xsl:template match="*" mode="PROCES_TO_DITA_STRIP_HTML"/>
  47. <xsl:template match="text()" mode="PROCES_TO_DITA_STRIP_HTML">
  48. <xsl:param name="limit"/>
  49. <xsl:variable name="parse_content">
  50. <xsl:choose>
  51. <xsl:when test=".='&#xD;'"/>
  52. <xsl:otherwise><xsl:call-template name="system_cache__appinfo:escaped_html_to_xml" exclude-result-prefixes="#all" extension-element-prefixes="">
  53. <xsl:with-param name="html" select="."/>
  54. </xsl:call-template></xsl:otherwise>
  55. </xsl:choose>
  56. </xsl:variable>
  57. <xsl:apply-templates select="$parse_content" mode="CONVERT_HTML_TO_DITA_CONTENT"/>
  58. </xsl:template>
  59. <xsl:template match="text()" mode="PROCES_TO_DITA_STRIP_HTML_TITLE">
  60. <xsl:param name="limit"/>
  61. <xsl:variable name="parse_title">
  62. <xsl:choose>
  63. <xsl:when test=".='&#xD;'"/>
  64. <xsl:otherwise><xsl:call-template name="system_cache__appinfo:escaped_html_to_xml" exclude-result-prefixes="#all" extension-element-prefixes="">
  65. <xsl:with-param name="html" select="."/>
  66. </xsl:call-template></xsl:otherwise>
  67. </xsl:choose>
  68. </xsl:variable>
  69. <xsl:copy-of select="$parse_title"/>
  70. </xsl:template>
  71. <xsl:template match="text()" mode="CONVERT_HTML_TO_DITA_CONTENT">
  72. <p><xsl:copy-of select="."/></p>
  73. </xsl:template>
  74. <xsl:template match="br" mode="CONVERT_HTML_TO_DITA_CONTENT">
  75. <xsl:param name="ph_used"/>
  76. <xsl:choose>
  77. <xsl:when test="$ph_used">
  78. <p/>
  79. <xsl:apply-templates mode="CONVERT_HTML_TO_DITA_CONTENT"/>
  80. </xsl:when>
  81. <xsl:otherwise>
  82. <p/><xsl:apply-templates mode="CONVERT_HTML_TO_DITA_CONTENT">
  83. <xsl:with-param name="ph_used" select="true()"/>
  84. </xsl:apply-templates>
  85. </xsl:otherwise>
  86. </xsl:choose>
  87. </xsl:template>
  88. </xsl:stylesheet>