images.xsl 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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"
  6. version="2.0">
  7. <!-- Do parsowania <images>
  8. <image x="1" y="1">
  9. <xmin>6525000.91100983333333333345</xmin>
  10. <ymin>6012859.46859783333333333345</ymin>
  11. <xmax>6525085.57767650000000000000</xmax>
  12. <ymax>6012944.13526450000000000000</ymax>
  13. <file>/Users/a.binder/Documents/xmlschema_procesy5/src-xmlschema/public_html/WPS_Functions/mapserver_gml_to_png/map/image-1-1.png</file>
  14. </image>
  15. <image x="2" y="1">
  16. <xmin>6525080.57767650000000000000</xmin>
  17. <ymin>6012859.46859783333333333345</ymin>
  18. <xmax>6525165.24434316666666666655</xmax>
  19. <ymax>6012944.13526450000000000000</ymax>
  20. <file>/Users/a.binder/Documents/xmlschema_procesy5/src-xmlschema/public_html/WPS_Functions/mapserver_gml_to_png/map/image-1-2.png</file>
  21. </image>
  22. <image x="1" y="2">
  23. <xmin>6525000.91100983333333333345</xmin>
  24. <ymin>6012939.13526450000000000000</ymin>
  25. <xmax>6525085.57767650000000000000</xmax>
  26. <ymax>6013023.80193116666666666655</ymax>
  27. <file>/Users/a.binder/Documents/xmlschema_procesy5/src-xmlschema/public_html/WPS_Functions/mapserver_gml_to_png/map/image-2-1.png</file>
  28. </image>
  29. <image x="2" y="2">
  30. <xmin>6525080.57767650000000000000</xmin>
  31. <ymin>6012939.13526450000000000000</ymin>
  32. <xmax>6525165.24434316666666666655</xmax>
  33. <ymax>6013023.80193116666666666655</ymax>
  34. <file>/Users/a.binder/Documents/xmlschema_procesy5/src-xmlschema/public_html/WPS_Functions/mapserver_gml_to_png/map/image-2-2.png</file>
  35. </image>
  36. </images> -->
  37. <xsl:output indent="yes"/>
  38. <xsl:strip-space elements="*"/>
  39. <xsl:template match="*" mode="system_cache__dita:postprocess_image_convert">
  40. <xsl:param name="ext" select="substring-after(TYPE,'/')"/>
  41. <xsl:param name="fileindex" select="ID"/>
  42. <base64_to_image srcfile="{$temp}/{$uuid}/{ID}_image.base64.{$ext}" dstfile="{$temp}/{$uuid}/{ID}_image.{$ext}" />
  43. </xsl:template>
  44. <xsl:template match="*" mode="system_cache__dita:process_image">
  45. <xsl:param name="width" required="yes"/>
  46. <xsl:param name="ext" select="substring-after(TYPE,'/')"/>
  47. <xsl:param name="fileindex" select="ID"/>
  48. <xsl:choose>
  49. <xsl:when test="number($width) &gt; 600">
  50. <image href="{$fileindex}_image.{$ext}" width="500"></image>
  51. </xsl:when>
  52. <xsl:otherwise>
  53. <image href="{$fileindex}_image.{$ext}" width="{$width}"></image>
  54. </xsl:otherwise>
  55. </xsl:choose>
  56. </xsl:template>
  57. <xsl:template match="*" mode="system_cache__dita:postprocess_image">
  58. <xsl:param name="ext" select="substring-after(TYPE,'/')"/>
  59. <xsl:param name="fileindex" select="ID"/>
  60. <xsl:result-document href="{$temp}/{$uuid}/{ID}_image.base64.{$ext}" omit-xml-declaration="yes">
  61. <xsl:value-of select="IMAGE/text()"/>
  62. </xsl:result-document>
  63. <xsl:apply-templates mode="system_cache__dita:postprocess_image_convert" select=".">
  64. <xsl:with-param name="ext" select="$ext"/>
  65. <xsl:with-param name="fileindex" select="$fileindex"/>
  66. </xsl:apply-templates>
  67. </xsl:template>
  68. <!-- IMAGES - gml!!! -->
  69. <xsl:template mode="system_cache__dita:preprocess_images" match="*">
  70. <xsl:param name="fileindex" select="concat(ID,'_',local-name())"/>
  71. <xsl:comment>#90 system_cache__dita:preprocess_images</xsl:comment>
  72. <xsl:apply-templates mode="system_cache__dita:preprocess_images__write" select=".">
  73. <xsl:with-param name="fileindex" select="$fileindex"/>
  74. </xsl:apply-templates>
  75. <xsl:result-document href="{$ditadir}/{$fileindex}.gml">
  76. <wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs"
  77. xmlns="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml"
  78. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  79. xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:default_objects="https://biuro.biall-net.pl/wfs/ault_objects">
  80. <xsl:attribute name="local-name" select="local-name()"/>
  81. <gml:featureMember>
  82. <xsl:copy-of select="." copy-namespaces="no"/>
  83. </gml:featureMember>
  84. </wfs:FeatureCollection>
  85. <!--<xsl:apply-templates mode="preprocess_gml_geometry_image" select="."/>-->
  86. </xsl:result-document>
  87. <!-- podsumwoania po stanach -->
  88. </xsl:template>
  89. <xsl:template mode="system_cache__dita:preprocess_images__write" match="*">
  90. <xsl:param name="fileindex" select="concat(ID,'_',local-name())"/>
  91. <gml_to_image srcfile="{$ditadir}/{$fileindex}.gml" dstfile="{$ditadir}/{$fileindex}.png.xml" fileindex="{$fileindex}" ditadir="{$ditadir}"/>
  92. </xsl:template>
  93. <xsl:template mode="system_cache__dita:images__read" match="*">
  94. <xsl:param name="fileindex" select="concat(ID,'_',local-name())"/>
  95. <!-- to read and parse system_cache__appinfo:images -->
  96. <!--<xsl:variable name="fileindex" select="concat(ID,'_',local-name())"/>-->
  97. <xsl:choose>
  98. <xsl:when test="doc-available(concat($ditadir,'/',$fileindex,'.png.xml'))">
  99. <xsl:apply-templates mode="system_cache__appinfo:images" select="doc(concat($ditadir,'/',$fileindex,'.png.xml'))">
  100. <xsl:with-param name="fileindex" select="$fileindex"/>
  101. </xsl:apply-templates>
  102. </xsl:when>
  103. <xsl:otherwise>
  104. <xsl:comment>#83 doc not aviable <xsl:value-of select="concat($ditadir,'/',$fileindex,'.png.xml')"/></xsl:comment>
  105. <xsl:message>#83 doc not aviable <xsl:value-of select="concat($ditadir,'/',$fileindex,'.png.xml')"/></xsl:message>
  106. </xsl:otherwise>
  107. </xsl:choose>
  108. </xsl:template><xsl:template mode="system_cache__appinfo:images" match="images">
  109. <xsl:param name="fileindex" required="yes"/> <!-- ex. 3161_IN7_MK_BAZA_DYSTRYBUCJI - is related dir in dita dir with images -->
  110. <xsl:apply-templates mode="system_cache__appinfo:images">
  111. <xsl:with-param name="fileindex" select="$fileindex"/>
  112. </xsl:apply-templates>
  113. </xsl:template>
  114. <xsl:template mode="system_cache__appinfo:images" match="image[@x and @y]">
  115. <xsl:param name="fileindex" required="yes"/>
  116. <image href="{$fileindex}/{$fileindex}_image-{@x}-{@y}.png" width="300"/>
  117. </xsl:template>
  118. <xsl:template mode="system_cache__appinfo:images" match="*">
  119. <xsl:message terminate="yes">#56 not expected data - needed @x and @y to be in xml image element: correct is:
  120. <image x="1" y="1">
  121. <xmin>6525000.91100983333333333345</xmin>
  122. <ymin>6012859.46859783333333333345</ymin>
  123. <xmax>6525085.57767650000000000000</xmax>
  124. <ymax>6012944.13526450000000000000</ymax>
  125. <file>/Users/a.binder/Documents/xmlschema_procesy5/src-xmlschema/public_html/WPS_Functions/mapserver_gml_to_png/map/image-1-1.png</file>
  126. </image>
  127. </xsl:message>
  128. </xsl:template>
  129. <xsl:template mode="system_cache__appinfo:images__write" match="*">
  130. <xsl:param name="fileindex" select="concat(ID,'_',local-name())"/>
  131. <gml_to_image srcfile="{$ditadir}/{$fileindex}.gml" dstfile="{$ditadir}/{$fileindex}.png.xml" fileindex="{$fileindex}" ditadir="{$ditadir}"/>
  132. </xsl:template>
  133. <xsl:template mode="system_cache__appinfo:images__read" match="*">
  134. <xsl:param name="fileindex" select="concat(ID,'_',local-name())"/>
  135. <!-- to read and parse system_cache__appinfo:images -->
  136. <!--<xsl:variable name="fileindex" select="concat(ID,'_',local-name())"/>-->
  137. <xsl:choose>
  138. <xsl:when test="doc-available(concat($ditadir,'/',$fileindex,'.png.xml'))">
  139. <xsl:apply-templates mode="system_cache__appinfo:images" select="doc(concat($ditadir,'/',$fileindex,'.png.xml'))">
  140. <xsl:with-param name="fileindex" select="$fileindex"/>
  141. </xsl:apply-templates>
  142. </xsl:when>
  143. <xsl:otherwise>
  144. <xsl:comment>#83 doc not aviable <xsl:value-of select="concat($ditadir,'/',$fileindex,'.png.xml')"/></xsl:comment>
  145. <xsl:message>#83 doc not aviable <xsl:value-of select="concat($ditadir,'/',$fileindex,'.png.xml')"/></xsl:message>
  146. </xsl:otherwise>
  147. </xsl:choose>
  148. </xsl:template>
  149. </xsl:stylesheet>