1
|
<?xml version="1.0"?>
|
2
|
|
3
|
<xsl:stylesheet version="1.0"
|
4
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
5
|
|
6
|
<xsl:template match="/">
|
7
|
<xsl:variable name="wfname" select="translate(.//WORKFLOW_NAME, ' ', '_')" />
|
8
|
|
9
|
<process-definition name="{$wfname}" xmlns="http://sarasvati.googlecode.com/ProcessDefinition">
|
10
|
<xsl:apply-templates select=".//NODE"/>
|
11
|
|
12
|
<node name="success" type="Success" />
|
13
|
<node name="failure" type="Failure" />
|
14
|
</process-definition>
|
15
|
</xsl:template>
|
16
|
|
17
|
<xsl:template match="NODE">
|
18
|
<xsl:element name="node" namespace="http://sarasvati.googlecode.com/ProcessDefinition">
|
19
|
<xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute>
|
20
|
<xsl:if test="@isJoin = 'true'">
|
21
|
<xsl:attribute name="joinType">and</xsl:attribute>
|
22
|
</xsl:if>
|
23
|
<xsl:if test="@isStart = 'true'">
|
24
|
<xsl:attribute name="isStart">true</xsl:attribute>
|
25
|
</xsl:if>
|
26
|
<xsl:if test="string-length(@type) > 0">
|
27
|
<xsl:attribute name="type"><xsl:value-of select="@type" /></xsl:attribute>
|
28
|
</xsl:if>
|
29
|
|
30
|
<xsl:apply-templates select=".//ARC"/>
|
31
|
|
32
|
<arc xmlns="http://sarasvati.googlecode.com/ProcessDefinition" name="failed" to="failure" />
|
33
|
|
34
|
<xsl:if test="count(.//PARAM[string-length(normalize-space(text())) > 0]) > 0">
|
35
|
<custom xmlns="http://sarasvati.googlecode.com/ProcessDefinition">
|
36
|
<xsl:apply-templates select=".//PARAM"/>
|
37
|
</custom>
|
38
|
</xsl:if>
|
39
|
</xsl:element>
|
40
|
</xsl:template>
|
41
|
|
42
|
<xsl:template match="ARC">
|
43
|
<xsl:element name="arc" namespace="http://sarasvati.googlecode.com/ProcessDefinition">
|
44
|
<xsl:attribute name="to"><xsl:value-of select="@to" /></xsl:attribute>
|
45
|
<xsl:if test="string-length(@name) > 0">
|
46
|
<xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute>
|
47
|
</xsl:if>
|
48
|
</xsl:element>
|
49
|
</xsl:template>
|
50
|
|
51
|
<xsl:template match="PARAM">
|
52
|
<xsl:if test="string-length(normalize-space(text())) > 0">
|
53
|
<xsl:element name="{@name}" namespace="http://sarasvati.googlecode.com/ProcessDefinition"><xsl:value-of select="text()" /></xsl:element>
|
54
|
</xsl:if>
|
55
|
</xsl:template>
|
56
|
|
57
|
</xsl:stylesheet>
|