Initial publication on git of project from 2006
[OpenWorkBench2MSP_Converter.git] / OWB2MSPConverterA.xsl
1 <?xml version="1.0"?>
2 <!--XSLT 1.0 - http://home.tiscali.de/hillerd - conversion of OpenWorkbench to MS Project - Preconditioning of OWB file -->
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
4 <xsl:output method="xml"/>
5
6 <!-- ****************************************************************** copy all, but make modification for some nodes * -->
7 <xsl:template match="*">
8 <xsl:copy>
9 <xsl:apply-templates select="@* | node()"/> <!-- all attributes (@*) and children-nodes -->
10 </xsl:copy>
11 </xsl:template>
12
13 <xsl:template match="@*"> <!-- copy the node and attributes -->
14 <xsl:copy/>
15 </xsl:template>
16
17 <!-- ****************************************************************** Task, PoolResource, BaseCalendars/Calendar **** -->
18 <xsl:template match="Task">
19 <xsl:copy>
20 <!-- add sequential ID (strangely goes in steps of 2) -->
21 <xsl:attribute name="sID"><xsl:value-of select='position() div 2'/></xsl:attribute>
22
23 <xsl:attribute name="wID"> <!-- working ID can be UID or taskID -->
24 <xsl:choose>
25 <xsl:when test='count(@taskID)>0'><xsl:value-of select='@taskID'/></xsl:when>
26 <xsl:otherwise> <xsl:value-of select='@UID'/> </xsl:otherwise>
27 </xsl:choose>
28 </xsl:attribute>
29
30 <xsl:apply-templates select="@* | node()"/> <!-- copy all attributes (@*) and child-nodes -->
31
32 </xsl:copy>
33 </xsl:template>
34
35 <!-- ****************************************************************** PoolResource, BaseCalendars/Calendar ********** -->
36 <xsl:template match="PoolResource|BaseCalendars/Calendar">
37 <xsl:copy>
38 <!-- add sequential ID (strangely goes in steps of 2) -->
39 <xsl:attribute name="sID"><xsl:value-of select='position() div 2'/></xsl:attribute>
40 <xsl:apply-templates select="@* | node()"/> <!-- copy all attributes (@*) and child-nodes -->
41 </xsl:copy>
42 </xsl:template>
43
44 </xsl:stylesheet>