Itron On-Demand Read XSL Transformations
The Oracle Utilities Smart Grid Gateway Adapter for Itron OpenWay supports multiple versions of the Itron OpenWay API. To achieve this support, several of the request XSLs check a version number embedded in the source schema. Similarly, the responses XSLs are designed to handle different source XML and map the values to the common SGG format.
The Itron on-demand read process uses the following XSL transformations.
D8-ContRdByEndptsRequest.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns1="http://www.itron.com/ami/2008/10/data"
xmlns:ns2="http://www.itron.com/ami/2008/10/common"
xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/*">
<ContingencyReadByEndpoints xmlns="http://www.itron.com/ami/2008/10/data">
<xsl:apply-templates select="./requestEnvelope/ContingencyReadByEndpoints/*"/>
</ContingencyReadByEndpoints>
</xsl:template>
<xsl:template match="ElectronicSerialNumbers">
<xsl:element name="ns2:ElectronicSerialNumbers">
<xsl:for-each select="./string">
<xsl:element name="ns3:string">
<xsl:value-of select="."/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="StatusChangedService">
<xsl:element name="ns2:StatusChangedService">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
<xsl:template match="Parameters">
<ns1:Parameters>
<ns1:ReadingStartTime><xsl:value-of select="./ReadingStartTime"/></ns1:ReadingStartTime>
<ns1:ReadingEndTime><xsl:value-of select="./ReadingEndTime"/></ns1:ReadingEndTime>
<xsl:if test="string-length(./PerformDemandReset) > 0">
<ns1:PerformDemandReset><xsl:value-of select="./PerformDemandReset"/></ns1:PerformDemandReset>
</xsl:if>
<xsl:if test="string-length(./RetrieveHomeNetworkData) > 0">
<ns1:RetrieveHomeNetworkData><xsl:value-of select="./RetrieveHomeNetworkData"/></ns1:RetrieveHomeNetworkData>
</xsl:if>
<xsl:if test="string-length(./RetrieveInstantaneousData) > 0">
<ns1:RetrieveInstantaneousData><xsl:value-of select="./RetrieveInstantaneousData"/></ns1:RetrieveInstantaneousData>
</xsl:if>
<xsl:if test="string-length(./RetrieveLastDemandReset) > 0">
<ns1:RetrieveLastDemandReset><xsl:value-of select="./RetrieveLastDemandReset"/></ns1:RetrieveLastDemandReset>
</xsl:if>
<xsl:if test="string-length(./RetrieveLoadProfileData) > 0">
<ns1:RetrieveLoadProfileData><xsl:value-of select="./RetrieveLoadProfileData"/></ns1:RetrieveLoadProfileData>
</xsl:if>
<xsl:if test="string-length(./RetrieveLogEvents) > 0">
<ns1:RetrieveLogEvents><xsl:value-of select="./RetrieveLogEvents"/></ns1:RetrieveLogEvents>
</xsl:if>
<xsl:if test="string-length(./RetrieveNetworkStatistics) > 0">
<ns1:RetrieveNetworkStatistics><xsl:value-of select="./RetrieveNetworkStatistics"/></ns1:RetrieveNetworkStatistics>
</xsl:if>
<xsl:if test="string-length(./RetrievePriorSelfRead) > 0">
<ns1:RetrievePriorSelfRead><xsl:value-of select="./RetrievePriorSelfRead"/></ns1:RetrievePriorSelfRead>
</xsl:if>
<xsl:if test="string-length(./RetrieveRecentRegisters) > 0">
<ns1:RetrieveRecentRegisters><xsl:value-of select="./RetrieveRecentRegisters"/></ns1:RetrieveRecentRegisters>
</xsl:if>
<xsl:if test="string-length(./RetrieveVoltageMonitorData) > 0">
<ns1:RetrieveVoltageMonitorData><xsl:value-of select="./RetrieveVoltageMonitorData"/></ns1:RetrieveVoltageMonitorData>
</xsl:if>
<xsl:if test="string-length(./ReportSelfReadOption) > 0">
<ns1:ReportSelfReadOption><xsl:value-of select="./ReportSelfReadOption"/></ns1:ReportSelfReadOption>
</xsl:if>
<xsl:if test="string-length(./RetrieveExtendedCurrentData) > 0">
<ns1:RetrieveExtendedCurrentData><xsl:value-of select="./RetrieveExtendedCurrentData"/></ns1:RetrieveExtendedCurrentData>
</xsl:if>
<xsl:if test="string-length(./RetrievePriorExtendedSelfReadData) > 0">
<ns1:RetrievePriorExtendedSelfReadData><xsl:value-of select="./RetrievePriorExtendedSelfReadData"/></ns1:RetrievePriorExtendedSelfReadData>
</xsl:if>
<xsl:if test="string-length(./RetrieveInstrumentationProfileData) > 0">
<ns1:RetrieveInstrumentationProfileData><xsl:value-of select="./RetrieveInstrumentationProfileData"/></ns1:RetrieveInstrumentationProfileData>
</xsl:if>
<xsl:if test="string-length(./RetrieveExtendedLoadProfileData) > 0">
<ns1:RetrieveExtendedLoadProfileData><xsl:value-of select="./RetrieveExtendedLoadProfileData"/></ns1:RetrieveExtendedLoadProfileData>
</xsl:if>
<xsl:if test="string-length(./RetrieveToolboxData) > 0">
<ns1:RetrieveToolboxData><xsl:value-of select="./RetrieveToolboxData"/></ns1:RetrieveToolboxData>
</xsl:if>
<xsl:if test="string-length(./RetrieveTemperatureMonitoringData) > 0">
<ns1:RetrieveTemperatureMonitoringData><xsl:value-of select="./RetrieveTemperatureMonitoringData"/></ns1:RetrieveTemperatureMonitoringData>
</xsl:if>
</ns1:Parameters>
</xsl:template>
<xsl:template match="*">
<xsl:element name="{local-name()}" namespace="http://www.itron.com/ami/2008/10/data">
<xsl:apply-templates select="*|text()"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
D8-ContRdByEndptsResponse.xsl
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://www.itron.com/ami/2008/10/data"
xmlns:com="http://www.itron.com/ami/2008/10/common"
exclude-result-prefixes="env ns1 com">
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<xsl:template match="env:Envelope">
<xsl:apply-templates select="./env:Body/*"/>
</xsl:template>
<xsl:template match="ns1:ContingencyReadByEndpointsResponse">
<responseDetail>
<responseEnvelope>
<ContingencyReadByEndpointsResponse>
<xsl:apply-templates select="./*"/>
</ContingencyReadByEndpointsResponse>
</responseEnvelope>
</responseDetail>
</xsl:template>
<xsl:template match="env:Fault[./detail/*[contains('|OperationFault|NoValidTargetsFoundFault|InvalidUriFormatFault|InvalidDateTimeRangeFault|ArgumentFault|TooManyConcurrentRequestsFault|SecurityFault|', concat('|',local-name(),'|'))]]">
<fault>
<xsl:apply-templates select="./detail/*"/>
</fault>
</xsl:template>
<xsl:template match="env:Fault">
<fault>
<xsl:apply-templates select="./*"/>
</fault>
</xsl:template>
<xsl:template match="detail">
<detail><xsl:apply-templates select="./*" mode="serialize"/></detail>
</xsl:template>
<xsl:template match="*">
<xsl:variable name="name">
<xsl:value-of select="local-name()"/>
</xsl:variable>
<xsl:element name="{$name}" namespace="">
<xsl:apply-templates select="*|text()"/>
</xsl:element>
</xsl:template>
<xsl:template match="*" mode="serialize">
<xsl:text><</xsl:text>
<xsl:value-of select="local-name()"/>
<xsl:for-each select="@*">
<xsl:value-of select="concat(' ', local-name())"/>
<xsl:text>="</xsl:text>
<xsl:value-of select="."/>
<xsl:text>"</xsl:text>
</xsl:for-each>
<xsl:text>></xsl:text>
<xsl:apply-templates select="*" mode="serialize"/>
<xsl:value-of select="."/>
<xsl:text></</xsl:text>
<xsl:value-of select="local-name()"/>
<xsl:text>></xsl:text>
</xsl:template>
</xsl:stylesheet>
D8-GetContRdByEndptsRsReq.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns1="http://www.itron.com/ami/2008/10/data"
xmlns:ns2="http://www.itron.com/ami/2008/10/common">
<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/*">
<GetContingencyReadByEndpointsResult xmlns="http://www.itron.com/ami/2008/10/data">
<xsl:apply-templates select="./requestEnvelope/GetContingencyReadByEndpointsResult/*" />
</GetContingencyReadByEndpointsResult>
</xsl:template>
<xsl:template match="Id">
<xsl:element name="ns2:Id">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
<xsl:template match="*">
<xsl:element name="{local-name()}" namespace="http://www.itron.com/ami/2008/10/data">
<xsl:apply-templates select="*|text()"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
D8-GetContRdByEndptsRsResp.xsl
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://www.itron.com/ami/2008/10/data"
xmlns:com="http://www.itron.com/ami/2008/10/common"
exclude-result-prefixes="env ns1 com">
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<xsl:template match="env:Envelope">
<xsl:apply-templates select="./env:Body/*"/>
</xsl:template>
<xsl:template match="ns1:GetContingencyReadByEndpointsResultResponse">
<responseDetail>
<responseEnvelope>
<GetContingencyReadByEndpointsResultResponse>
<xsl:apply-templates select="./*"/>
</GetContingencyReadByEndpointsResultResponse>
</responseEnvelope>
</responseDetail>
</xsl:template>
<xsl:template match="*">
<xsl:variable name="name">
<xsl:value-of select="local-name()"/>
</xsl:variable>
<xsl:element name="{$name}" namespace="">
<xsl:apply-templates select="*|text()"/>
</xsl:element>
</xsl:template>
<xsl:template match="env:Fault[./detail/*[contains('|OperationFault|RequestNotFoundFault|RequestNotFinishedFault|ArgumentFault|TooManyConcurrentRequestsFault|SecurityFault|', concat('|',local-name(),'|'))]]">
<fault>
<xsl:apply-templates select="./detail/*"/>
</fault>
</xsl:template>
<xsl:template match="env:Fault">
<fault>
<xsl:apply-templates select="./*"/>
</fault>
</xsl:template>
<xsl:template match="detail">
<detail><xsl:apply-templates select="./*" mode="serialize"/></detail>
</xsl:template>
<xsl:template match="*" mode="serialize">
<xsl:text><</xsl:text>
<xsl:value-of select="local-name()"/>
<xsl:for-each select="@*">
<xsl:value-of select="concat(' ', local-name())"/>
<xsl:text>="</xsl:text>
<xsl:value-of select="."/>
<xsl:text>"</xsl:text>
</xsl:for-each>
<xsl:text>></xsl:text>
<xsl:apply-templates select="*" mode="serialize"/>
<xsl:value-of select="."/>
<xsl:text></</xsl:text>
<xsl:value-of select="local-name()"/>
<xsl:text>></xsl:text>
</xsl:template>
</xsl:stylesheet>
D8-DataSubSvcRequest.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"
xmlns:data="http://www.itron.com/ami/2008/10/data"
xmlns:com="http://www.itron.com/ami/2008/10/common"
xmlns:ev="http://www.itron.com/ami/2008/10/events"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
exclude-result-prefixes="data com ev soap11 soap12">
<xsl:template match="soap11:Envelope">
<xsl:apply-templates select="//data:DataArrived"/>
</xsl:template>
<xsl:template match="soap11:Body">
<xsl:apply-templates select="//data:DataArrived"/>
</xsl:template>
<xsl:template match="data:DataArrived">
<DataArrived>
<input>
<RequestToken>
<Id><xsl:value-of select="./data:input/data:RequestToken/com:Id"/></Id>
</RequestToken>
<ReadDataCollection>
<xsl:for-each select="./data:input/data:ReadDataCollection/data:ReadData">
<ReadData>
<Identifier><xsl:value-of select="./data:Identifier"/></Identifier>
<DeviceClass><xsl:value-of select="./data:DeviceClass"/></DeviceClass>
<ScalingType><xsl:value-of select="./data:ScalingType"/></ScalingType>
<xsl:call-template name="EventLog"/>
<xsl:call-template name="LoadProfileChannels"/>
<xsl:call-template name="NetworkStatistics"/>
<xsl:call-template name="RegisterValues"/>
<xsl:call-template name="BlockInfo"/>
<xsl:if test="./data:DeviceSerialNumber">
<DeviceSerialNumber><xsl:value-of select="./data:DeviceSerialNumber"/></DeviceSerialNumber>
</xsl:if>
</ReadData>
</xsl:for-each>
</ReadDataCollection>
<xsl:if test="count(./data:input/data:RequestMetadata/*) > 0">
<RequestMetadata>
<xsl:copy-of select="./data:input/data:RequestMetadata/*"/>
</RequestMetadata>
</xsl:if>
</input>
</DataArrived>
</xsl:template>
<xsl:template name="EventLog">
<xsl:if test="count(./data:EventLog/ev:MeterEvents/*) > 0 or count(./data:EventLog/ev:UnreportedEventCount) > 0">
<EventLog>
<xsl:if test="count(./data:EventLog/ev:MeterEvents/*) > 0">
<MeterEvents>
<xsl:for-each select="./data:EventLog/ev:MeterEvents/ev:MeterEvent">
<MeterEvent>
<Timestamp><xsl:value-of select="./ev:Timestamp"/></Timestamp>
<Category><xsl:value-of select="./ev:Category"/></Category>
<LogType><xsl:value-of select="./ev:LogType"/></LogType>
<Name><xsl:value-of select="./ev:Name"/></Name>
<xsl:if test="count(./ev:Arguments/*) > 0">
<Arguments>
<xsl:for-each select="./ev:Arguments/ev:Argument">
<Argument>
<Name><xsl:value-of select="./ev:Name"/></Name>
<Value><xsl:value-of select="./ev:Value"/></Value>
</Argument>
</xsl:for-each>
</Arguments>
</xsl:if>
<xsl:if test="./ev:ID">
<ID><xsl:value-of select="./ev:ID"/></ID>
</xsl:if>
<xsl:if test="./ev:Source">
<Source><xsl:value-of select="./ev:Source"/></Source>
</xsl:if>
<xsl:if test="./ev:SequenceNumber">
<SequenceNumber><xsl:value-of select="./ev:SequenceNumber"/></SequenceNumber>
</xsl:if>
</MeterEvent>
</xsl:for-each>
</MeterEvents>
</xsl:if>
<xsl:if test="./data:EventLog/ev:UnreportedEventCount">
<UnreportedEventCount><xsl:value-of select="./data:EventLog/ev:UnreportedEventCount"/></UnreportedEventCount>
</xsl:if>
</EventLog>
</xsl:if>
</xsl:template>
<xsl:template name="LoadProfileChannels">
<xsl:if test="count(./data:LoadProfileChannels/data:LoadProfileChannel/data:IntervalLength) > 0">
<LoadProfileChannels>
<xsl:for-each select="./data:LoadProfileChannels/data:LoadProfileChannel">
<LoadProfileChannel>
<IntervalLength><xsl:value-of select="./data:IntervalLength"/></IntervalLength>
<PulseMultiplier><xsl:value-of select="./data:PulseMultiplier"/></PulseMultiplier>
<Quantity><xsl:value-of select="./data:Quantity"/></Quantity>
<TimeDataEnd><xsl:value-of select="./data:TimeDataEnd"/></TimeDataEnd>
<IntervalValues>
<xsl:for-each select="./data:IntervalValues/data:IntervalValue">
<IntervalValue>
<ChannelValue><xsl:value-of select="./data:ChannelValue"/></ChannelValue>
<xsl:for-each select="./data:ProfileStatuses/data:ProfileStatus">
<ProfileStatuses>
<ProfileStatus><xsl:value-of select="."/></ProfileStatus>
</ProfileStatuses>
</xsl:for-each>
</IntervalValue>
</xsl:for-each>
</IntervalValues>
</LoadProfileChannel>
</xsl:for-each>
</LoadProfileChannels>
</xsl:if>
</xsl:template>
<xsl:template name="NetworkStatistics">
<xsl:if test="count(./data:NetworkStatistics/data:NetworkStatistic/data:Name) > 0">
<NetworkStatistics>
<xsl:for-each select="./data:NetworkStatistics/data:NetworkStatistic">
<NetworkStatistic>
<Name><xsl:value-of select="./data:Name"/></Name>
<NetworkKind><xsl:value-of select="./data:NetworkKind"/></NetworkKind>
<Value><xsl:value-of select="./data:Value"/></Value>
</NetworkStatistic>
</xsl:for-each>
</NetworkStatistics>
</xsl:if>
</xsl:template>
<xsl:template name="RegisterValues">
<xsl:if test="count(./data:RegisterValues/data:RegisterValue/data:Quantity) > 0">
<RegisterValues>
<xsl:for-each select="./data:RegisterValues/data:RegisterValue">
<RegisterValue>
<Quantity><xsl:value-of select="./data:Quantity"/></Quantity>
<Source><xsl:value-of select="./data:Source"/></Source>
<Timestamp><xsl:value-of select="substring(./data:Timestamp, 1, 19)"/></Timestamp>
<Value><xsl:value-of select="./data:Value"/></Value>
<xsl:if test="count(./data:Status/data:string) > 0">
<Status>
<xsl:for-each select="./data:Status/data:string">
<string><xsl:value-of select="."/></string>
</xsl:for-each>
</Status>
</xsl:if>
</RegisterValue>
</xsl:for-each>
</RegisterValues>
</xsl:if>
</xsl:template>
<xsl:template name="BlockInfo">
<xsl:if test="count(./data:BlockInfo/data:Block) > 0">
<BlockInfo>
<Block><xsl:value-of select="./data:BlockInfo/data:Block"/></Block>
<TotalBlocks><xsl:value-of select="./data:BlockInfo/data:TotalBlocks"/></TotalBlocks>
</BlockInfo>
</xsl:if>
</xsl:template>
<!-- When the SOAP Message has already been transformed by the SOAP Proxy -->
<xsl:template match="DataArrived[namespace-uri(.) != 'http://www.itron.com/ami/2008/10/data']">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
D8-DataSubSvcResponse.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="http://www.itron.com/ami/2008/10/data">
<xsl:template match="/">
<soap11:Envelope>
<soap11:Header/>
<soap11:Body>
<tns:DataArrivedResponse/>
</soap11:Body>
</soap11:Envelope>
</xsl:template>
</xsl:stylesheet>
D8-ReqStsChgSvcRequest.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"
xmlns:com="http://www.itron.com/ami/2008/10/common"
exclude-result-prefixes="soap11 soap12 com">
<xsl:template match="soap11:Envelope">
<xsl:apply-templates select="//com:StatusChanged"/>
</xsl:template>
<xsl:template match="soap11:Body">
<xsl:apply-templates select="//com:StatusChanged"/>
</xsl:template>
<xsl:template match="com:StatusChanged">
<StatusChanged>
<bo/>
<input>
<RequestStatus>
<RequestToken>
<Id><xsl:value-of select="./com:input/com:RequestStatus/com:RequestToken/com:Id"/></Id>
</RequestToken>
<State><xsl:value-of select="./com:input/com:RequestStatus/com:State"/></State>
<EndpointsScheduled><xsl:value-of select="./com:input/com:RequestStatus/com:EndpointsScheduled"/></EndpointsScheduled>
<Result><xsl:value-of select="./com:input/com:RequestStatus/com:Result"/></Result>
<SuccessfulEndpoints><xsl:value-of select="./com:input/com:RequestStatus/com:SuccessfulEndpoints"/></SuccessfulEndpoints>
<FailedEndpoints><xsl:value-of select="./com:input/com:RequestStatus/com:FailedEndpoints"/></FailedEndpoints>
<xsl:if test="string-length(./com:input/com:RequestStatus/com:CreatedWhen) > 0">
<CreatedWhen><xsl:value-of select="substring(./com:input/com:RequestStatus/com:CreatedWhen, 1, 23)"/></CreatedWhen>
</xsl:if>
<xsl:if test="string-length(./com:input/com:RequestStatus/com:FinishedWhen) > 0">
<FinishedWhen><xsl:value-of select="substring(./com:input/com:RequestStatus/com:FinishedWhen, 1, 23)"/></FinishedWhen>
</xsl:if>
<xsl:if test="count(./com:input/com:RequestStatus/com:Metadata/*) > 0">
<Metadata>
<xsl:copy-of select="./com:input/com:RequestStatus/com:Metadata/*"/>
</Metadata>
</xsl:if>
</RequestStatus>
</input>
</StatusChanged>
</xsl:template>
<!-- When the SOAP Message has already been transformed by the SOAP Proxy -->
<xsl:template match="StatusChanged[namespace-uri(.) != 'http://www.itron.com/ami/2008/10/common']">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
D8-RequestStatusChangedServiceResponse.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="http://www.itron.com/ami/2008/10/common">
<xsl:template match="/">
<soap11:Envelope>
<soap11:Header/>
<soap11:Body>
<tns:StatusChangedResponse/>
</soap11:Body>
</soap11:Envelope>
</xsl:template>
</xsl:stylesheet>