parse_dita_templ.xsl 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. exclude-result-prefixes="xs"
  6. version="2.0">
  7. <!-- @2016-11 bindera: ten template ma przeparsowac plik dita i podstawic w nim sposob przetwarzania aby sciagnac stworzyc procesy w miejsce data-about.
  8. Potem do podpiecia do innych przetwarzan -->
  9. <xsl:output indent="yes" />
  10. <xsl:strip-space elements="*"/>
  11. <xsl:include href="PROCES_INCLUDE.xsl"/>
  12. <xsl:template match="topic" mode="DITA_PARSE_templ">
  13. <xsl:element name="{name()}">
  14. <xsl:apply-templates mode="#current" select="@*"/>
  15. <xsl:copy-of select="title"/>
  16. <xsl:copy-of select="body"/>
  17. <xsl:variable name="ID_PROCES" select="//.[@base='PROCES_INCLUDE']"/>
  18. <xsl:variable name="topic_id" select="@topic_sfx_mwx_yx"/>
  19. <!--<xsl:apply-templates mode="#current"/>-->
  20. <xsl:if test="$ID_PROCES">
  21. <xsl:call-template name="PROCES_INCLUDE">
  22. <xsl:with-param name="ID_PROCESS" select="$ID_PROCES"/>
  23. </xsl:call-template>
  24. </xsl:if>
  25. </xsl:element>
  26. </xsl:template>
  27. <xsl:template name="PROCES_INCLUDE">
  28. <xsl:param name="ID_PROCESS" required="yes"/>
  29. <xsl:variable name="proces_node" select="$CRM_PROCES.xml//item[ID=$ID_PROCESS]"/>
  30. <topic>
  31. <xsl:attribute name="id" select="concat('asd',$ID_PROCESS)"/>
  32. <title>
  33. <xsl:apply-templates mode="PROCES_TO_DITA_STRIP_HTML_TITLE" select="$proces_node/DESC/text()">
  34. <xsl:with-param name="limit" select="50"/>
  35. </xsl:apply-templates>
  36. </title>
  37. <body>
  38. <xsl:apply-templates mode="PROCES_TO_DITA_STRIP_HTML" select="$proces_node/OPIS/text()"/>
  39. </body>
  40. <xsl:for-each select="$CRM_PROCES.xml//item[PARENT_ID=$ID_PROCESS]">
  41. <xsl:call-template name="PROCES_INCLUDE">
  42. <xsl:with-param name="ID_PROCESS" select="ID"/>
  43. </xsl:call-template>
  44. </xsl:for-each>
  45. </topic>
  46. </xsl:template>
  47. <!--<xsl:template match="*" mode="DITA_PARSE_templ">
  48. <xsl:element name="{name()}">
  49. <xsl:apply-templates mode="#current" select="@*"/>
  50. <xsl:apply-templates mode="#current"/>
  51. </xsl:element>
  52. </xsl:template>-->
  53. <xsl:template match="apiname[@base='PROCES_INCLUDE']" mode="DITA_PARSE_templ">
  54. generuje costam
  55. </xsl:template>
  56. <xsl:template match="@*" mode="DITA_PARSE_templ">
  57. <xsl:attribute name="{name()}" select="."/>
  58. </xsl:template>
  59. </xsl:stylesheet>