← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5582: Set sdmx-hd data import to use dxf2 by default

 

------------------------------------------------------------
revno: 5582
committer: Bob Jolliffe bobjolliffe@xxxxxxxxx
branch nick: dhis2
timestamp: Sun 2011-12-25 12:51:38 +0000
message:
  Set sdmx-hd data import to use dxf2 by default
added:
  dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/cross2dxf2.xsl
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/transforms.xml


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== added file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/cross2dxf2.xsl'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/cross2dxf2.xsl	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/cross2dxf2.xsl	2011-12-25 12:51:38 +0000
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+  xmlns:d="http://dhis2.org/schema/dxf/2.0";
+  version="1.0">
+  
+  <xsl:output method="xml" indent="yes" />
+
+  <xsl:template match="/">
+      <d:dxf>
+        <d:dataValueSets>
+        <xsl:for-each select="//*[local-name()='Group']">
+          <xsl:variable name="dataset"
+            select="substring-before(substring-after(substring-after(namespace-uri(),'='),':'),':')"/>
+          <xsl:variable name="period" select="@*[local-name()='TIME_PERIOD']"/>
+          <d:dataValueSet period='{$period}' idScheme='CODE' dataset='{$dataset}'>
+
+            <xsl:for-each select="//*[local-name()='Section']">
+              <xsl:for-each select="//*[local-name()='OBS_VALUE']">
+                <xsl:variable name="orgunit" select="@*[local-name()='FACILITY']"/>
+                <xsl:variable name="dataElement" select="@*[local-name()='DATAELEMENT']"/>
+                <xsl:variable name="value" select="@*[local-name()='value']"/>
+                <d:dataValue dataElement='{$dataElement}' orgunit='{$orgunit}' value='{$value}' />
+              </xsl:for-each>
+            </xsl:for-each>
+          </d:dataValueSet>
+        </xsl:for-each>
+      </d:dataValueSets>
+    </d:dxf>
+  </xsl:template>
+
+</xsl:stylesheet>

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/transforms.xml'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/transforms.xml	2010-09-30 11:22:27 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/transforms.xml	2011-12-25 12:51:38 +0000
@@ -5,7 +5,7 @@
        <description>GML to DXF orgunits</description>
    </transform>
     <transform tag="{http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message}CrossSectionalData";>
-        <xslt>cross2dxf.xsl</xslt>
+        <xslt>cross2dxf2.xsl</xslt>
         <description>SDMX-HD Cross Sectional Data Import</description>
     </transform>
     <transform tag="{http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message}GenericMetadata";>