Mon XSL :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
| <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:g="http://graphml.graphdrawing.org/xmlns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:y="http://www.yworks.com/xml/graphml"
xmlns:yed="http://www.yworks.com/xml/yed/3"
xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd"
exclude-result-prefixes="xsl g xalan xsi y yed"
>
<xsl:output method="xml"
encoding="UTF-8"
indent="yes"
xalan:indent-amount="2"
omit-xml-declaration="yes" />
<!-- récupère les identifiants -->
<!-- Workflow -->
<xsl:variable name="workflowId_id" select="/g:graphml/g:key[@for='graph'][@attr.name='workflowId']/@id" />
<xsl:variable name="workflowName_id" select="/g:graphml/g:key[@for='graph'][@attr.name='workflowName']/@id" />
<xsl:variable name="workflowManager_id" select="/g:graphml/g:key[@for='graph'][@attr.name='workflowManager']/@id" />
<xsl:variable name="workflowNatures_id" select="/g:graphml/g:key[@for='graph'][@attr.name='natures']/@id" />
<xsl:variable name="workflowProperties_id" select="/g:graphml/g:key[@for='graph'][@attr.name='properties']/@id" />
<xsl:variable name="workflowInitialState_id" select="/g:graphml/g:key[@for='graph'][@attr.name='initialState']/@id" />
<!-- state -->
<xsl:variable name="stateCode_id" select="/g:graphml/g:key[@for='node'][@attr.name='code']/@id" />
<xsl:variable name="stateNature_id" select="/g:graphml/g:key[@for='node'][@attr.name='nature']/@id" />
<xsl:variable name="stateProperties_id" select="/g:graphml/g:key[@for='node'][@attr.name='properties']/@id" />
<xsl:variable name="stateRoles_id" select="/g:graphml/g:key[@for='node'][@attr.name='roles']/@id" />
<xsl:variable name="stateOrder_id" select="/g:graphml/g:key[@for='node'][@attr.name='order']/@id" />
<!-- action -->
<xsl:variable name="actionCode_id" select="/g:graphml/g:key[@for='edge'][@attr.name='code']/@id" />
<xsl:variable name="type_id" select="/g:graphml/g:key[@for='edge'][@attr.name='type']/@id" />
<xsl:variable name="method_id" select="/g:graphml/g:key[@for='edge'][@attr.name='method']/@id" />
<xsl:variable name="actionProperties_id" select="/g:graphml/g:key[@for='edge'][@attr.name='properties']/@id" />
<xsl:variable name="actionRoles_id" select="/g:graphml/g:key[@for='edge'][@attr.name='roles']/@id" />
<!-- actions -->
<xsl:template match="/">
<workflow managerRef="{g:graphml/g:graph/g:data[@key=$workflowManager_id]}"
label="{g:graphml/g:graph/g:data[@key=$workflowName_id]}"
id="{g:graphml/g:graph/g:data[@key=$workflowId_id]}" >
<properties>
<xsl:for-each select="g:graphml/g:graph/g:data[@key=$workflowProperties_id]/*">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:for-each>
</properties>
<natures>
<xsl:for-each select="g:graphml/g:graph/g:data[@key=$workflowNatures_id]/*">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:for-each>
</natures>
<states initial_state="{g:graphml/g:graph/g:data[@key=$workflowInitialState_id]}">
<xsl:for-each select="g:graphml/g:graph//g:node">
<xsl:sort select="g:data[@key=$stateOrder_id]" data-type="number"/>
<xsl:apply-templates select="." />
</xsl:for-each>
</states>
</workflow>
</xsl:template>
<!-- tous les noeuds avec un code -->
<xsl:template match="g:node[g:data[@key=$stateCode_id]]">
<xsl:variable name="id_noeud_actuel" select="@id" />
<state id="{g:data[@key=$stateCode_id]}"
nature="{g:data[@key=$stateNature_id]}"
label="{g:data/y:ShapeNode/y:NodeLabel}"
order="{g:data[@key=$stateOrder_id]}">
<properties>
<xsl:for-each select="g:data[@key=$stateProperties_id]/*">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:for-each>
</properties>
<roles>
<xsl:for-each select="g:data[@key=$stateRoles_id]/*">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:for-each>
</roles>
<actions>
<xsl:for-each select="//g:edge[@source = $id_noeud_actuel]">
<xsl:sort select="g:data[@key=$actionCode_id]"/>
<xsl:apply-templates select="."/>
</xsl:for-each>
</actions>
</state>
</xsl:template>
<!-- les noueds sans code -->
<xsl:template match="g:node"/>
<!-- tous les liens avec un code -->
<xsl:template match="g:edge[g:data[@key=$actionCode_id]]">
<xsl:variable name="id_action_cible" select="@target" />
<action id="{g:data[@key=$actionCode_id]}"
label="{g:data/y:PolyLineEdge/y:EdgeLabel}"
final_state="{//g:node[@id=$id_action_cible]/g:data[@key=$stateCode_id]}"
type="{g:data[@key=$type_id]}"
method="{g:data[@key=$method_id]}">
<roles>
<xsl:for-each select="g:data[@key=$actionRoles_id]/*">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:for-each>
</roles>
<properties>
<xsl:for-each select="g:data[@key=$actionProperties_id]/*">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:for-each>
</properties>
</action>
</xsl:template>
<!-- les actions sans code -->
<xsl:template match="g:edge"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet> |
Mon input :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
| <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
<!--Created by yFiles for Java HEAD-Current-->
<key for="graphml" id="d0" yfiles.type="resources"/>
<key for="port" id="d1" yfiles.type="portgraphics"/>
<key for="port" id="d2" yfiles.type="portgeometry"/>
<key for="port" id="d3" yfiles.type="portuserdata"/>
<key attr.name="code" attr.type="string" for="node" id="d4">
<default/>
</key>
<key attr.name="nature" attr.type="string" for="node" id="d5">
<default/>
</key>
<key attr.name="properties" for="node" id="d6"/>
<key attr.name="roles" for="node" id="d7">
<default/>
</key>
<key attr.name="order" attr.type="int" for="node" id="d8">
<default>0</default>
</key>
<key attr.name="url" attr.type="string" for="node" id="d9"/>
<key attr.name="description" attr.type="string" for="node" id="d10"/>
<key for="node" id="d11" yfiles.type="nodegraphics"/>
<key attr.name="Description" attr.type="string" for="graph" id="d12">
<default/>
</key>
<key attr.name="workflowId" attr.type="string" for="graph" id="d13">
<default/>
</key>
<key attr.name="workflowName" attr.type="string" for="graph" id="d14">
<default/>
</key>
<key attr.name="workflowManager" attr.type="string" for="graph" id="d15">
<default/>
</key>
<key attr.name="properties" for="graph" id="d16">
<default/>
</key>
<key attr.name="natures" for="graph" id="d17">
<default/>
</key>
<key attr.name="initialState" attr.type="string" for="graph" id="d18">
<default/>
</key>
<key attr.name="code" attr.type="string" for="edge" id="d19">
<default/>
</key>
<key attr.name="type" attr.type="string" for="edge" id="d20">
<default/>
</key>
<key attr.name="method" attr.type="string" for="edge" id="d21">
<default/>
</key>
<key attr.name="properties" for="edge" id="d22">
<default/>
</key>
<key attr.name="roles" for="edge" id="d23">
<default/>
</key>
<key attr.name="url" attr.type="string" for="edge" id="d24"/>
<key attr.name="description" attr.type="string" for="edge" id="d25"/>
<key for="edge" id="d26" yfiles.type="edgegraphics"/>
<graph edgedefault="directed" id="G">
<data key="d13"><![CDATA[request]]></data>
<data key="d14"><![CDATA[Purchase Request]]></data>
<data key="d15"><![CDATA[purchase2Manager]]></data>
<data key="d16">
<property name="editPurchase" value="false" xmlns=""/>
<property name="addItems" value="false" xmlns=""/>
<property name="workflowActions" value="true" xmlns=""/>
<property name="modifyItems" value="false" xmlns=""/>
<property name="printCompetitionReport" value="false" xmlns=""/>
</data>
<data key="d17">
<nature id="REQ" label="En Demande" xmlns="">
<roles>
<role id="MGER"/>
</roles>
</nature>
<nature id="RFQ" label="En Consultation" xmlns="">
<roles>
<role id="MGER"/>
</roles>
</nature>
<nature id="ORD" label="En Commande" xmlns="">
<properties>
<property name="printCompetitionReport" value="true"/>
</properties>
<roles>
<role id="MGER"/>
</roles>
</nature>
<nature id="DEL" label="En Livraison" xmlns="">
<properties>
<property name="printCompetitionReport" value="true"/>
</properties>
<roles>
<role id="MGER"/>
</roles>
</nature>
</data>
<data key="d18"><![CDATA[RNW]]></data>
<node id="n0" yfiles.foldertype="group">
<data key="d6"/>
<data key="d9"/>
<data key="d11">
<y:ProxyAutoBoundsNode>
<y:Realizers active="0">
<y:GroupNode>
<y:Geometry height="432.1474067134964" width="564.8265314408409" x="-1386.5107486536604" y="-344.3950080092302"/>
<y:Fill color="#CAECFF84" transparent="false"/>
<y:BorderStyle color="#666699" type="dotted" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#99CCFF" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="22.37646484375" modelName="internal" modelPosition="t" textColor="#000000" visible="true" width="564.8265314408409" x="0.0" y="0.0">Boucle Demande de Devis</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="false" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="71" bottomF="71.13720925713784" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
<y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="-736.3615384615387" y="-347.15796190850654"/>
<y:Fill color="#CAECFF84" transparent="false"/>
<y:BorderStyle color="#666699" type="dotted" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#99CCFF" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="22.37646484375" modelName="internal" modelPosition="t" textColor="#000000" visible="true" width="50.0" x="0.0" y="0.0">2</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="false" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
</y:Realizers>
</y:ProxyAutoBoundsNode>
</data> |
Mon output :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| <workflow id="request" label="Purchase Request" managerRef="purchase2Manager">
<properties>
<property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="editPurchase" value="false"/>
<property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="addItems" value="false"/>
<property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="workflowActions" value="true"/>
<property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="modifyItems" value="false"/>
<property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="printCompetitionReport" value="false"/>
</properties>
<natures>
<nature xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" id="REQ" label="En Demande">
<roles>
<role id="MGER"/>
</roles>
</nature>
<nature xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" id="RFQ" label="En Consultation">
<roles>
<role id="MGER"/>
</roles>
</nature>
<nature xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" id="ORD" label="En Commande">
<properties>
<property name="printCompetitionReport" value="true"/>
</properties>
<roles>
<role id="MGER"/>
</roles>
</nature>
<nature xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" id="DEL" label="En Livraison">
<properties>
<property name="printCompetitionReport" value="true"/>
</properties>
<roles>
<role id="MGER"/>
</roles>
</nature>
</natures>
<states initial_state="RNW">
<state order="1" label="Nouvelle Demande" nature="REQ" id="RNW">
<properties>
<property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="editPurchase" value="true"/>
<property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="addItems" value="true"/>
<property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="modifyItems" value="true"/>
</properties>
... |
il semble que le problème vienne du fait que je copie des noeuds qui n'on pas de ns..
par exemple "property" :
<property name="editPurchase" value="false" xmlns=""/>
deviens
<property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="editPurchase" value="false"/>
même en supprimant le xmlns=""...
c'est compliqué ces namespaces....
Merci en tous cas!
P.
Partager