IN7_DZIENNIK_KORESP.xsl 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:default_db__x3A__IN7_DZIENNIK_KORESP="https://biuro.biall-net.pl/wfs/default_db/table/IN7_DZIENNIK_KORESP.xsd"
  4. xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db"
  5. xmlns:wfs="http://www.opengis.net/wfs"
  6. xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
  7. xmlns:gml="http://www.opengis.net/gml"
  8. xmlns:exsl="http://exslt.org/common"
  9. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  10. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  11. xmlns:default_db="https://biuro.biall-net.pl/wfs/default_db"
  12. exclude-result-prefixes="xs"
  13. version="2.0">
  14. <xsl:output indent="yes" />
  15. <xsl:strip-space elements="*"/>
  16. <!--<xsl:include href="../../WPS_Functions/DownloadProcesToDita/PROCES_INCLUDE.xsl"/>-->
  17. <!--<xsl:include href="PROCES_INCLUDE.xsl"/>-->
  18. <xsl:param name="dita_task_template_file_param" select="'main.dita'"/><!--dita template file -->
  19. <xsl:variable name="dita_task_template_file" select="doc($dita_task_template_file_param)"/><!--first level data associated to main.dita template $(dita_task_template_file_param)-->
  20. <!-- przetwarzamy pierwszy otrzymany obiekt z API - pojedynczy feature - czy nie powinnismy pierw przeleciec druk aby z niego sie dowiedziec co pobrac? -->
  21. <xsl:template match="wfs:FeatureCollection|gml:featureMember">
  22. <xsl:apply-templates/>
  23. </xsl:template>
  24. <!-- glowny punkt dzialania -->
  25. <xsl:template match="IN7_DZIENNIK_KORESP|default_db__x3A__IN7_DZIENNIK_KORESP:IN7_DZIENNIK_KORESP|p5_default_db:IN7_DZIENNIK_KORESP|default_db:in7_dziennik_koresp"> <!-- default_db__x3A__IN7_DZIENNIK_KORESP:IN7_DZIENNIK_KORESP|p5_default_db:IN7_DZIENNIK_KORESP| -->
  26. <!--<xsl:param name="dita_task_template_file"/>-->
  27. <xsl:variable name="input_obj_with_xpath">
  28. <xsl:apply-templates mode="system_cache__appinfo:add_xpath_path_to_elements" select=".">
  29. <xsl:with-param name="system_cache__appinfo:curr_xpath" select="name()"/>
  30. </xsl:apply-templates>
  31. </xsl:variable>
  32. <xsl:result-document href="IN7_DZIENNIK_KORESP.dita_input_obj_with_xpath.xml">
  33. <xsl:copy-of select="$input_obj_with_xpath"/>
  34. </xsl:result-document>
  35. <xsl:variable name="template_with_fit_vars">
  36. <xsl:apply-templates mode="Procesy5_dita_assingn_values_x_path" select="$dita_task_template_file"> <!-- exslt:node-set($-->
  37. <xsl:with-param name="parent_obj" select="$input_obj_with_xpath"/>
  38. </xsl:apply-templates>
  39. <!--<xsl:copy-of select="$dita_task_template_file"/>-->
  40. </xsl:variable>
  41. <xsl:copy-of select="$template_with_fit_vars"/>
  42. </xsl:template>
  43. <xsl:template match="*">
  44. <!--Nie przeszlo!
  45. <xsl:value-of select="name()" />-->
  46. </xsl:template>
  47. <xsl:template match="topic" mode="Procesy5_dita_assingn_values_x_path">
  48. <xsl:param name="parent_obj" />
  49. <topic>
  50. <xsl:copy-of select="@*"/>
  51. <xsl:attribute name="xsi:noNamespaceSchemaLocation" select="'urn:oasis:names:tc:dita:xsd:task.xsd'"/>
  52. <xsl:apply-templates mode="Procesy5_dita_assingn_values_x_path">
  53. <xsl:with-param name="parent_obj" select="$parent_obj"/>
  54. </xsl:apply-templates>
  55. </topic>
  56. </xsl:template>
  57. <xsl:template mode="Procesy5_dita_assingn_values_x_path" match="*"><!-- testowe do przeniesienia do glow.repo - do podstawienia wartosci z elementow w druku DITA -->
  58. <xsl:param name="parent_obj" /><!-- glowny obiekt z ktorego beda brane wartosci do podstawiania -->
  59. <xsl:for-each select=".">
  60. <xsl:choose>
  61. <!--<xsl:when test="node()='topic'">asdad</xsl:when>-->
  62. <xsl:when test="name()='RelatedFeature'">
  63. <xsl:for-each select="data/apiname[@base='PROCES_INCLUDE']">
  64. <xsl:apply-templates mode="PROCES_INCLUDE">
  65. <xsl:with-param name="ID_PROCES" select="text()"/>
  66. </xsl:apply-templates>
  67. </xsl:for-each>
  68. </xsl:when>
  69. <xsl:when test="name()='data-about'">
  70. <xsl:for-each select="data/apiname[@base='PROCES_INCLUDE']">
  71. <xsl:apply-templates mode="PROCES_INCLUDE">
  72. <xsl:with-param name="ID_PROCES" select="text()"/>
  73. </xsl:apply-templates>
  74. </xsl:for-each>
  75. </xsl:when>
  76. <xsl:otherwise>
  77. <xsl:element name="{name()}">
  78. <!--<xsl:copy-of select="namespace::node()"/>-->
  79. <xsl:for-each select="@*">
  80. <xsl:choose>
  81. <xsl:when test="name()='xpath'">
  82. <xsl:variable name="xpath" select="."/>
  83. <!--<xsl:attribute name="xpath_parsed" select="."/>-->
  84. <!--1:<xsl:value-of select="$parent_obj//node()[@system_cache__appinfo:xpath=$xpath]/text()"/>-->
  85. <!--<xsl:value-of select="$parent_obj//node()[local-name()=$xpath]/text()"/>-->
  86. <!--V:<xsl:value-of select="$xpath"/>-->
  87. <xsl:copy-of select="$parent_obj//node()[local-name()=$xpath]/text()"/>
  88. </xsl:when>
  89. <xsl:otherwise><xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute></xsl:otherwise>
  90. </xsl:choose>
  91. </xsl:for-each>
  92. <xsl:value-of select="text()"/>
  93. <xsl:apply-templates mode="Procesy5_dita_assingn_values_x_path">
  94. <xsl:with-param name="parent_obj" select="$parent_obj"/>
  95. </xsl:apply-templates>
  96. </xsl:element>
  97. </xsl:otherwise>
  98. </xsl:choose>
  99. </xsl:for-each>
  100. </xsl:template>
  101. <xsl:template match="text()" mode="Procesy5_dita_assingn_values_x_path"/>
  102. <xsl:template mode="system_cache__appinfo:add_xpath_path_to_elements" match="*">
  103. <xsl:param name="system_cache__appinfo:curr_xpath"/>
  104. <xsl:variable name="system_cache__appinfo:curr_xpath_tmpl">
  105. <xsl:choose>
  106. <xsl:when test="$system_cache__appinfo:curr_xpath=''">
  107. <xsl:value-of select="name()"/>
  108. </xsl:when>
  109. <xsl:otherwise>
  110. <xsl:value-of select="concat($system_cache__appinfo:curr_xpath,'/',name())"/>
  111. </xsl:otherwise>
  112. </xsl:choose>
  113. </xsl:variable>
  114. <!--<xsl:variable name="curr_xpath_tmpl" select="'asdf'"/>-->
  115. <xsl:element name="{name()}">
  116. <xsl:attribute name="xpath"><xsl:value-of select="$system_cache__appinfo:curr_xpath_tmpl"/></xsl:attribute>
  117. <xsl:for-each select="@*">
  118. <xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute>
  119. </xsl:for-each>
  120. <xsl:value-of select="text()"/>
  121. <xsl:apply-templates mode="system_cache__appinfo:add_xpath_path_to_elements">
  122. <xsl:with-param name="system_cache__appinfo:curr_xpath" select="$system_cache__appinfo:curr_xpath_tmpl"/>
  123. </xsl:apply-templates>
  124. </xsl:element>
  125. </xsl:template>
  126. <xsl:template match="text()" mode="system_cache__appinfo:add_xpath_path_to_elements"/>
  127. </xsl:stylesheet>