dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19835
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8818: Updated sdmx-hd to dxf2 transform
------------------------------------------------------------
revno: 8818
committer: Bob Jolliffe <bobjolliffe@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-11-01 08:55:35 +0000
message:
Updated sdmx-hd to dxf2 transform
modified:
dhis-2/dhis-services/dhis-service-integration/src/main/resources/transform/cross2dxf2.xsl
--
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
=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/main/resources/transform/cross2dxf2.xsl'
--- dhis-2/dhis-services/dhis-service-integration/src/main/resources/transform/cross2dxf2.xsl 2012-06-01 21:56:18 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/resources/transform/cross2dxf2.xsl 2012-11-01 08:55:35 +0000
@@ -1,31 +1,30 @@
<?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">
+ 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:output method="xml" indent="yes" />
+
+ <xsl:template match="/">
+ <xsl:for-each select="//*[local-name()='DataSet']">
+ <d:dataValueSet period='{@TIME_PERIOD}'
+ orgUnitIdScheme='code'
+ dataElementIdScheme='code'
+ dataSet='{@datasetID}'
+ orgUnit='{@FACILITY}'>
+ <xsl:apply-templates />
+ </d:dataValueSet>
</xsl:for-each>
- </d:dataValueSets>
- </d:dxf>
- </xsl:template>
-
+ </xsl:template>
+
+ <xsl:template match='*[local-name()="OBS_VALUE"]'>
+ <xsl:element name="d:dataValue" >
+ <xsl:attribute name="dataElement"><xsl:value-of select="@DATAELEMENT"/></xsl:attribute>
+ <xsl:if test="@DISAGG">
+ <xsl:attribute name="categoryOptionCombo"><xsl:value-of select="@DISAGG"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="value"><xsl:value-of select="@value"/></xsl:attribute>
+ </xsl:element>
+
+ </xsl:template>
</xsl:stylesheet>