My first xml doc has ProtectionOrder that is not deleted. The output displayed by my xslt is correct.
The second xml doc has ProtectionOrder that have been deleted. The output displayed by my xslt is not working.
How do I make my xslt work for each of the two xml documents?
Expected output for ProtectionOrderStatus for ProtectionOrder that have not been deleted xml document This is working for me.
<ext:ProtectionOrderStatus>
<ext:ProtectionOrderStatusCode>SBJO</ext:ProtectionOrderStatusCode>
<ext:ProtectionOrderStatusDate>2017-03-17</ext:ProtectionOrderStatusDate>
</ext:ProtectionOrderStatus>
xml input document for a ProtectionOrder that is not deleted
<Integration>
<ControlPoint Timestamp="3/17/2017 10:20:59 AM">SAVE-PROTECTION-ORDER</ControlPoint>
<ProtectionOrder Op="E">
<Deleted>false</Deleted>
<ProtectionOrderNumber>1700063</ProtectionOrderNumber>
<Issued>03/17/2017</Issued>
<Statuses>
<Status Op="A">
<Current>true</Current>
<Active>Yes</Active>
<Date Op="A">03/17/2017</Date>
<Type Op="A" Word="SBJO">Signed By Judicial Officer</Type>
<TimestampCreate Op="A">03/17/2017 10:20:59:350</TimestampCreate>
</Status>
</Statuses>
<TimestampCreate>03/17/2017 10:20:28:403</TimestampCreate>
<TimestampChange>03/17/2017 10:20:59:350</TimestampChange>
</ProtectionOrder>
</Integration>
Expected output when a ProtectionOrder has been deleted
This is not working for me.
xml doc for ProtectionOrder that is deleted
<ext:ProtectionOrderStatus>
<ext:ProtectionOrderStatusCode>DELETED</ext:ProtectionOrderStatusCode>
<ext:ProtectionOrderStatusDate>2017-03-17</ext:ProtectionOrderStatusDate>
</ext:ProtectionOrderStatus>
The following is my output which is wrong
<ext:ProtectionOrderStatus>
<ext:ProtectionOrderStatusCode/>
<ext:ProtectionOrderStatusDate>2017-03-16</ext:ProtectionOrderStatusDate>
</ext:ProtectionOrderStatus>
<ProtectionOrderStatus>SBJO<ProtectionOrderStatusDate>03/17/2017</ProtectionOrderStatusDate>
</ProtectionOrderStatus>
xslt code
="1.0"="UTF-8"
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:mscef="courts.state.mn.us/extfun" xmlns:ext="http://www.courts.state.mn.us/ProtectionOrderExtension/1.0">
<xsl:variable name="vCurrentTimestamp">
<xsl:choose>
<xsl:when test="count(/Integration/ControlPoint)>0">
<xsl:value-of select="mscef:formatDateTimeNumeric(string(/Integration/ControlPoint/@Timestamp))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="mscef:currentDateTimeNumeric()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="vStatusDate" select="Statuses/Status[mscef:formatDateTimeNumeric(mscef:fixOdysseyTimestamp(string(TimestampCreate))) <=$vCurrentTimestamp][1]/Date"/>
<xsl:variable name="vStatusWord" select="Statuses/Status[mscef:formatDateTimeNumeric(mscef:fixOdysseyTimestamp(string(TimestampCreate))) <=$vCurrentTimestamp][1]/Type/@Word"/>
<ext:ProtectionOrderStatus>
<xsl:choose>
<xsl:when test="Deleted='true'">
<ext:ProtectionOrderStatusCode>DELETED</ext:ProtectionOrderStatusCode>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$vStatusWord"/>
</xsl:otherwise>
</xsl:choose>
<ext:ProtectionOrderStatusDate>
<xsl:value-of select="mscef:formatDate(string($vStatusDate))"/>
</ext:ProtectionOrderStatusDate>
</ext:ProtectionOrderStatus>
<msxsl:script language="JScript" implements-prefix="mscef"><![CDATA[
</msxsl:script>
</xsl:stylesheet>
What I have tried:
="1.0"="UTF-8"
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:mscef="courts.state.mn.us/extfun" xmlns:ext="http://www.courts.state.mn.us/ProtectionOrderExtension/1.0">
<xsl:variable name="vCurrentTimestamp">
<xsl:choose>
<xsl:when test="count(/Integration/ControlPoint)>0">
<xsl:value-of select="mscef:formatDateTimeNumeric(string(/Integration/ControlPoint/@Timestamp))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="mscef:currentDateTimeNumeric()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="vStatusDate" select="Statuses/Status[mscef:formatDateTimeNumeric(mscef:fixOdysseyTimestamp(string(TimestampCreate))) <=$vCurrentTimestamp][1]/Date"/>
<xsl:variable name="vStatusWord" select="Statuses/Status[mscef:formatDateTimeNumeric(mscef:fixOdysseyTimestamp(string(TimestampCreate))) <=$vCurrentTimestamp][1]/Type/@Word"/>
<ext:ProtectionOrderStatus>
<xsl:choose>
<xsl:when test="Deleted='true'">
<ext:ProtectionOrderStatusCode>DELETED</ext:ProtectionOrderStatusCode>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$vStatusWord"/>
</xsl:otherwise>
</xsl:choose>
<ext:ProtectionOrderStatusDate>
<xsl:value-of select="mscef:formatDate(string($vStatusDate))"/>
</ext:ProtectionOrderStatusDate>
</ext:ProtectionOrderStatus>
<msxsl:script language="JScript" implements-prefix="mscef"><![CDATA[
</msxsl:script>
</xsl:stylesheet>