p5yed.yed.graphml.xsl 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
  3. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  4. xmlns:p5bws="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/WPS_Functions.xsd"
  5. xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
  6. xmlns:p5yed="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/yed/p5yed.xsd"
  7. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  8. xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java"
  9. xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0"
  10. xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0"
  11. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  12. xmlns:y="http://www.yworks.com/xml/graphml"
  13. xmlns:yed="http://www.yworks.com/xml/yed/3" exclude-result-prefixes="xs yed" version="2.0">
  14. <xsl:import href="p5yed.y.import.xsl"/>
  15. <xsl:output indent="yes"/>
  16. <xsl:strip-space elements="*"/>
  17. <xsl:param name="yed:basedir"/>
  18. <xsl:include href="p5yed.yed.graphml.node.xsl"/>
  19. <xsl:include href="p5yed.yed.colors.xsl"/>
  20. <xsl:variable name="yed:portgraphics.id" select="'d1'"/>
  21. <xsl:variable name="yed:portgeometry.id" select="'d2'"/>
  22. <xsl:variable name="yed:portuserdata.id" select="'d3'"/>
  23. <xsl:variable name="yed:attr.name.url.id" select="'d4'"/>
  24. <xsl:variable name="yed:for.node.attr.name.description.id" select="'d5'"/>
  25. <xsl:variable name="yed:for.node.yfiles.type.id" select="'d6'"/>
  26. <xsl:variable name="yed:for.graphml.resources.id" select="'d7'"/>
  27. <xsl:variable name="yed:for.edge.attr.name.url.id" select="'d8'"/>
  28. <xsl:variable name="yed:for.edge.attr.name.description.id" select="'d9'"/>
  29. <xsl:variable name="yed:for.edge.edgegraphics.id" select="'d10'"/>
  30. <xsl:template mode="yed:graphml" match="*">
  31. <graphml xmlns="http://graphml.graphdrawing.org/xmlns"
  32. xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java"
  33. xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0"
  34. xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0"
  35. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  36. xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3"
  37. xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
  38. <!--Created by yEd 3.18.1-->
  39. <key attr.name="Description" attr.type="string" for="graph" id="d0"/>
  40. <key for="port" id="{$yed:portgraphics.id}" yfiles.type="portgraphics"/>
  41. <key for="port" id="{$yed:portgeometry.id}" yfiles.type="portgeometry"/>
  42. <key for="port" id="{$yed:portuserdata.id}" yfiles.type="portuserdata"/>
  43. <key attr.name="url" attr.type="string" for="node" id="{$yed:attr.name.url.id}"/>
  44. <key attr.name="description" attr.type="string" for="node"
  45. id="{$yed:for.node.attr.name.description.id}"/>
  46. <key for="node" id="{$yed:for.node.yfiles.type.id}" yfiles.type="nodegraphics"/>
  47. <key for="graphml" id="{$yed:for.graphml.resources.id}" yfiles.type="resources"/>
  48. <key attr.name="url" attr.type="string" for="edge" id="{$yed:for.edge.attr.name.url.id}"/>
  49. <key attr.name="description" attr.type="string" for="edge" id="{$yed:for.edge.attr.name.description.id}"/>
  50. <key for="edge" id="{$yed:for.edge.edgegraphics.id}" yfiles.type="edgegraphics"/>
  51. <graph edgedefault="directed" id="G">
  52. <data key="d0"/>
  53. <xsl:for-each-group select=".//*[@p5yed:clousure.from.len = '1']" group-by="@p5yed:edge.source"><!-- Sciezki 1 rysujemy -->
  54. <xsl:apply-templates mode="yed:graphml.nodes" select=".">
  55. <xsl:with-param name="position" select="position()"/>
  56. </xsl:apply-templates>
  57. </xsl:for-each-group>
  58. <xsl:for-each-group select=".//*[@p5yed:clousure.from.len = '1']" group-by="concat(@p5yed:edge.source,':',@p5yed:node)"> <!-- Sciezki 1 rysujemy -->
  59. <xsl:apply-templates mode="yed:graphml.edge" select=".">
  60. <xsl:with-param name="position" select="position()"/>
  61. </xsl:apply-templates>
  62. </xsl:for-each-group>
  63. </graph>
  64. <data key="{$yed:for.graphml.resources.id}">
  65. <y:Resources/>
  66. </data>
  67. </graphml>
  68. </xsl:template>
  69. <xsl:template mode="yed:graphml.nodes" match="*[@p5yed:edge.source]"
  70. xpath-default-namespace="http://graphml.graphdrawing.org/xmlns">
  71. <xsl:param name="yed:graphml.nodes.fix" select="@p5yed:edge.source"/>
  72. <node id="{$yed:graphml.nodes.fix}" xmlns="http://graphml.graphdrawing.org/xmlns">
  73. <data key="{$yed:for.node.attr.name.description.id}"/>
  74. <data key="{$yed:for.node.yfiles.type.id}">
  75. <y:GenericNode configuration="BevelNode2">
  76. <!--<y:Geometry height="30.0" width="45.0" x="471.5" y="193.00000000000023"/>-->
  77. <!--<y:Fill color="#FF9900" transparent="false"/>-->
  78. <xsl:apply-imports/>
  79. <y:BorderStyle hasColor="false" type="line" width="1.0"/>
  80. <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="16.7060546875" xml:space="preserve" y="5.93359375">
  81. <xsl:value-of select="@p5yed:node.from.nodegraphics.text"/>
  82. <y:LabelModel>
  83. <y:SmartNodeLabelModel distance="4.0"/>
  84. </y:LabelModel>
  85. <y:ModelParameter>
  86. <y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
  87. </y:ModelParameter>
  88. </y:NodeLabel>
  89. </y:GenericNode>
  90. </data>
  91. </node>
  92. <!--<node id="{@p5yed:node}" xmlns="http://graphml.graphdrawing.org/xmlns">
  93. <data key="{$yed:for.node.attr.name.description.id}"/>
  94. <data key="{$yed:for.node.yfiles.type.id}">
  95. <y:GenericNode configuration="BevelNode2">
  96. <!-\-<y:Geometry height="30.0" width="45.0" x="471.5" y="193.00000000000023"/>-\->
  97. <!-\-<y:Fill color="#FF9900" transparent="false"/>-\->
  98. <xsl:apply-imports/>
  99. <y:BorderStyle hasColor="false" type="line" width="1.0"/>
  100. <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="16.7060546875" xml:space="preserve" y="5.93359375">
  101. <xsl:value-of select="@p5yed:node.from.nodegraphics.text"/>
  102. <y:LabelModel>
  103. <y:SmartNodeLabelModel distance="4.0"/>
  104. </y:LabelModel>
  105. <y:ModelParameter>
  106. <y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
  107. </y:ModelParameter>
  108. </y:NodeLabel>
  109. </y:GenericNode>
  110. </data>
  111. </node>-->
  112. </xsl:template>
  113. <xsl:template mode="yed:graphml.edge" match="*[@p5yed:edge.source]"
  114. xpath-default-namespace="http://graphml.graphdrawing.org/xmlns">
  115. <xsl:param name="position" required="yes"/>
  116. <edge id="e{$position}" xmlns="http://graphml.graphdrawing.org/xmlns"> <!-- source="n0" target="n1" -->
  117. <xsl:apply-imports/>
  118. <data key="{$yed:for.edge.attr.name.description.id}"/>
  119. <data key="{$yed:for.edge.edgegraphics.id}">
  120. <y:PolyLineEdge>
  121. <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
  122. <y:LineStyle color="#000000" type="line" width="1.0"/>
  123. <y:Arrows source="none" target="standard"/>
  124. <y:BendStyle smoothed="false"/>
  125. </y:PolyLineEdge>
  126. </data>
  127. </edge>
  128. <xsl:choose>
  129. <xsl:when test="following::*[@p5yed:edge.source = current()/@p5yed:node][1]"/>
  130. <xsl:when test="preceding::*[@p5yed:edge.source = current()/@p5yed:node][1]"/>
  131. <xsl:otherwise>
  132. <xsl:message>#100 adding missing current()/@p5yed:node=<xsl:value-of select="@p5yed:node"/>; by @p5yed:edge.source</xsl:message>
  133. <xsl:apply-templates mode="yed:graphml.nodes" select=".">
  134. <xsl:with-param name="yed:graphml.nodes.fix" select="@p5yed:node"/>
  135. </xsl:apply-templates>
  136. </xsl:otherwise>
  137. </xsl:choose>
  138. </xsl:template>
  139. <xsl:template mode="yed:graphml.edge" match="*|text()|comment()"/>
  140. </xsl:stylesheet>