p5yed.y.import.xsl 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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:p5yed="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/yed/p5yed.xsd"
  5. xmlns:yed="http://www.yworks.com/xml/yed/3"
  6. xmlns:p5xsl="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/xsl_interface/xsl_interface.xsd"
  7. xmlns:y="http://www.yworks.com/xml/graphml"
  8. exclude-result-prefixes="xs yed p5xsl"
  9. version="2.0">
  10. <xsl:include href="../xsl_interface/p5xsl.ascii.xsl"/>
  11. <xsl:param name="y:debug"/>
  12. <xsl:variable name="colors">
  13. <colors>
  14. <color pos="0">#FFAAFF</color>
  15. <color pos="1">#003300</color>
  16. <color pos="2">#AA0000</color>
  17. <color pos="3">#AAAA00</color>
  18. <color pos="4">#AAAAAA</color>
  19. <color pos="5">#FF0000</color>
  20. <color pos="6">#FFAA00</color>
  21. <color pos="7">#FFFF00</color>
  22. <color pos="8">#FF00AA</color>
  23. <color pos="9">#FFAAAA</color>
  24. </colors>
  25. <dashed>
  26. <dash pos="0">dashed</dash>
  27. <dash pos="1">line</dash>
  28. </dashed>
  29. </xsl:variable>
  30. <xsl:template mode="yed:graphml.nodes" match="*[@p5yed:node.from.nodegraphics.type]">
  31. <xsl:apply-templates mode="y:Fill" select="."/>
  32. </xsl:template>
  33. <xsl:template mode="yed:graphml.edge" match="*[@p5yed:edge.source and @p5yed:node]">
  34. <xsl:apply-templates mode="y:edge" select="."/>
  35. </xsl:template>
  36. <xsl:template mode="y:edge" match="*[@p5yed:edge.source and @p5yed:node and not(p5yed:node.unique.descriptor)]">
  37. <xsl:attribute name="source" select="@p5yed:edge.source"/>
  38. <xsl:attribute name="target" select="@p5yed:node"/>
  39. </xsl:template>
  40. <xsl:template mode="y:edge" match="*[@p5yed:edge.source and @p5yed:node and p5yed:node.unique.descriptor]">
  41. <!-- kontekst wyzwolenia .//* -->
  42. <xsl:attribute name="source" select="@p5yed:edge.source"/>
  43. <xsl:attribute name="target" select="@p5yed:node"/>
  44. <!-- szukamy pierwszego przedstawiciela p5yed:node.unique.descriptor.source -->
  45. <!-- szukamy pierwszego przedstawiciela p5yed:node.unique.descriptor.target -->
  46. <!--<xsl:copy-of select="p5yed:node.unique.descriptor"/>-->
  47. <xsl:variable name="context" select="."/>
  48. <!--<p5yed:node.unique.descriptor.target>-->
  49. <xsl:for-each select="p5yed:node.unique.descriptor/*[ not(@p5yed:clousure.node.unique.descriptor.not)]"> <!-- todo remove cesc -->
  50. <!-- <xsl:copy>-->
  51. <!--<xsl:attribute name="look_for.name" select="text()"/>-->
  52. <xsl:comment>#61 p5yed:node.unique.descriptor look for <xsl:value-of select="text()"/> </xsl:comment>
  53. <xsl:for-each select="$context/root()/descendant-or-self::*[ name()=current()/local-name() and text()=current()/text() and parent::p5yed:node.unique.descriptor ][1]/ancestor::*[ local-name()='path.included' or local-name()='path.clousure.following'][1]">
  54. <!--<xsl:copy-of select="@p5yed:node"/>-->
  55. <xsl:comment>#64 found <xsl:copy-of select="@p5yed:node"/> </xsl:comment>
  56. </xsl:for-each>
  57. <!--</xsl:copy>-->
  58. </xsl:for-each>
  59. <!--</p5yed:node.unique.descriptor.target>-->
  60. </xsl:template>
  61. <xsl:template mode="y:edge" match="*"/>
  62. <xsl:template mode="y:Fill" match="*[@p5yed:node.from.nodegraphics.type]">
  63. <y:Fill>
  64. <xsl:variable name="colors.count" select="count($colors//color)"/>
  65. <xsl:if test="number($y:debug) &gt; 3"><xsl:attribute name="colors.count" select="$colors.count"/></xsl:if>
  66. <xsl:variable name="mod" select="p5xsl:ascii.sum(@p5yed:node.from.nodegraphics.type) mod $colors.count"/>
  67. <xsl:if test="number($y:debug) &gt; 3"><xsl:attribute name="mod" select="$mod"/></xsl:if>
  68. <xsl:attribute name="color" select="$colors//color[ @pos = $mod ]/text()"/>
  69. <xsl:attribute name="transparent" select="'false'"/>
  70. <!--<xsl:value-of select="p5xsl:ascii.sum(@p5yed:node.nodegraphics.type)"/>-->
  71. </y:Fill>
  72. </xsl:template>
  73. </xsl:stylesheet>