如何更新我的XSLT以显示正确的输出? [英] How can I update my XSLT so it displays correct output?

查看:84
本文介绍了如何更新我的XSLT以显示正确的输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的第一个xml文档包含未删除的ProtectionOrder。我的xslt显示的输出是正确的。

第二个xml doc已经删除了ProtectionOrder。我的xslt显示的输出无效。



如何使xslt对两个xml文档中的每一个都有效?



ProtectionOrderStatus for ProtectionOrder的预期输出尚未删除xml文档这对我有用。



< pre lang =xml> < ext:ProtectionOrderStatus >
< ext:ProtectionOrderStatusCode > SBJO < / ext:ProtectionOrderStatusCode >
< ext:ProtectionOrderStatusDate > 2017-03-17 < / ext:ProtectionOrderStatusDate >
< / ext:ProtectionOrderStatus >





未删除的ProtectionOrder的xml输入文档



 <  集成 >  
< ControlPoint 时间戳 = 2017/3/17 10:20:59 > SAVE-PROTECTION-ORDER < / ControlPoint >
< ProtectionOrder Op = E >
< 已删除 > false < /已删除 >
< ProtectionOrderNumber > 1700063 < / ProtectionOrderNumber >
< 已发布 > 03 / 17/2017 < /已发布 >
< 状态 >
< 状态 操作 = >
< 当前 > true < /当前 >
< 有效 > < / Active >
< 日期 Op = > 03/17/2017 < / Date >
< 类型 操作 = Word = SBJO > 由司法官员签名< /类型 >
< TimestampCreate 操作 = > 03/17/2017 10:20:59:350 < / TimestampCreate >
< /状态 < span class =code-keyword>>
< /状态 >
< TimestampCreate > 03/17/2017 10:20:28:403 < / TimestampCreate >
< TimestampChange > 03/17/2017 10:20 :59:350 < / TimestampChange >
< / ProtectionOrder >
< / Integration >



删除ProtectionOrder时的预期输出

这对我不起作用。

已删除的ProtectionOrder的xml doc



 <   ext:ProtectionOrderStatus  >  
< ext :ProtectionOrderStatusCode > DELETED < / ext:ProtectionOrderStatusCode >
< ext:ProtectionOrderStatusDate > 2017-03-17 < / ext:ProtectionOrderStatusDate >
< / ext:ProtectionOrderStatus >





以下是我的输出错误



 <   ext:ProtectionOrderStatus  >  
< ext:ProtectionOrderStatusCode / >
< ext:ProtectionOrderStatusDate > 2017-03-16 < / ext:ProtectionOrderStatusDate >
< / ext:ProtectionOrderStatus >
< ProtectionOrderStatus > SBJO < ProtectionOrderStatusDate > 03 / 17/2017 < / ProtectionOrderStatusDate >
< / ProtectionOrderStatus < span class =code-keyword>>





xslt code



 <?  xml     version   =  1.0    encoding   =  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\">
< ;! - ext:ProtectionOrderStatus - >
< xsl:variable name = vCurrentTimestamp >
< < span class =code-leadattribute> xsl:choose >
< xsl:when test = count(/ Integration / ControlPoint)> 0 > ;
< xsl:value-of 选择 = mscef:formatDateTimeNumeric(string(/ Integration / ControlPoint / @ Timestamp)) / >
< / xsl:when >
< xsl:otherwise >
< xsl:value-of select = mscef:currentDateTimeNumeric() / >
< / xsl:otherwise >
< / xsl:choose >
< / xsl:variable >
< xsl:variable 名称 = vStatusDate 选择 = 状态/状态[mscef:formatDateTimeNumeric(mscef:fixOdysseyTimestamp(string(TimestampCreate)))< = $ vCurrentTimestamp] [1] / Date / >
< xsl:variable name = vStatusWord 选择 = < span class =code-keyword>状态/状态[mscef:formatDateTimeNumeric(mscef:fixOdysseyTimestamp(string(TimestampCreate)))< = $ vCurrentTimestamp] [1] / Type / @ Word / >
< ext:ProtectionOrderStatus >
< xsl:choose >
< xsl:when test < span class =code-keyword> = 已删除='true' >
< ext:ProtectionOrderStatusCode > DELETED < / ext:ProtectionOrderStatusCode >
< / xsl:when >
< xsl:otherwise >
< xsl:value-of 选择 = $ vStatusWord / >
< / xsl:otherwise >
< / xsl :选择 >
< ext:ProtectionOrderStatusDate >
< xsl:value-of select = mscef:formatDate(string($ vStatusDate)) / < span class =code-keyword>>
< / ext:ProtectionOrderStatusDate >
< / ext:ProtectionOrderStatus >

< msxsl:script language = JScript implements-prefix = mscef > <! [CDATA [
function currentDateTime(){
var oDate = new Date();
返回formatDateTime(oDate.toString());
}
function formatTime(sTime){
if(sTime.length == 0){
return;
}
else {
var oDate = new Date(sTime);
var str = oDate.getSeconds();
返回padZeroes(oDate.getHours()。toString(),2)+:+ padZeroes(oDate.getMinutes(),2)+:+ padZeroes(oDate.getSeconds(),2)+ - + padZeroes(oDate.getTimezoneOffset()/ 60,2)+:00;
}
}
函数formatDate(sDate){
if(sDate.length == 0){
return;
}
else {
var oDate = new Date(sDate);
var str = oDate.getSeconds();
返回oDate.getFullYear()+ - + padZeroes(oDate.getMonth()+ 1,2)+ - + padZeroes(oDate.getDate(),2);
}
}
函数formatDateTime(sDate){
if(sDate.length == 0){
return;
}
else {
var oDate = new Date(sDate);
var str = oDate.getSeconds();
返回oDate.getFullYear()+ - + padZeroes(oDate.getMonth()+ 1,2)+ - + padZeroes(oDate.getDate(),2)+T+ padZeroes(oDate .getHours()。toString(),2)+:+ padZeroes(oDate.getMinutes(),2)+:+ padZeroes(oDate.getSeconds(),2)+ - + padZeroes(oDate。 getTimezoneOffset()/ 60,2)+:00;
}
}
函数formatDateTimeNumeric(sDate){
if(sDate.length == 0){
return;
}
else {
var oDate = new Date(sDate);
var str = oDate.getSeconds();
返回+ oDate.getFullYear()。toString()+ padZeroes(oDate.getMonth()+ 1,2)+ padZeroes(oDate.getDate(),2)+ padZeroes(oDate.getHours()。 toString(),2)+ padZeroes(oDate.getMinutes(),2)+ padZeroes(oDate.getSeconds(),2);
}
}
函数currentDateTimeNumeric(){
var oDate = new Date();
var str = oDate.getSeconds();
返回+ oDate.getFullYear()。toString()+ padZeroes(oDate.getMonth()+ 1,2)+ padZeroes(oDate.getDate(),2)+ padZeroes(oDate.getHours()。 toString(),2)+ padZeroes(oDate.getMinutes(),2)+ padZeroes(oDate.getSeconds(),2);
}

函数fixOdysseyTimestamp(sDate){
/ *在秒和毫秒之间替换:* /
if(sDate.length == 0){
返回;
}
else {
var strParts1 = sDate.split();
var strTime = strParts1 [1];
var strParts2 = strTime.split(:);
返回strParts1 [0] ++ strParts2 [0] +:+ strParts2 [1] +:+ strParts2 [2];
}
}
]]>

< / msxsl:script >
< / xsl:stylesheet >





我的尝试:



< pre lang =xml> <? xml version = 1.0 encoding = UTF-8 >
< xsl:stylesheet 版本 = 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 >
<! - ext:ProtectionOrderStatus - >
< xsl:variable 名称 = vCurrentTimestamp > ;
< xsl:choose >
< xsl:when test = count(/ Integration / ControlPoint)> 0 >
< xsl:value-of 选择 = mscef:formatDateTimeNumeric(string(/ Integration / ControlPoint / @ Timestamp)) / >
< / xsl:when >
< xsl:否则 >
< xsl:value-of 选择 = mscef:currentDateTimeNumeric() / >
< / xsl :否则 >
< / xsl:选择 >
< / xsl:variable >
< xsl:variable name = vStatusDate select = 状态/状态[mscef:formatDateTimeNumeric(mscef:fixOdysseyTimestamp(string(TimestampCreate)) )< = $ vCurrentTimestamp] [1] / D.吃 / >
< xsl:variable name = vStatusWord < span class =code-attribute> select = 状态/状态[mscef:formatDateTimeNumeric(mscef: fixOdysseyTimestamp(string(TimestampCreate)))< = $ vCurrentTimestamp] [1] / Type / @ Word / >
< ext:ProtectionOrderStatus >
< xsl:choose >
< xsl:when < span class =code-attribute> test = Deleted ='true' >
< ext:ProtectionOrderStatusCode > DELETED < / ext:ProtectionOrderStatusCode >
< / xsl:when >
< xsl:otherwise >
< XSL: 选择 = $ vStatusWord / >
< / xsl:otherwise >
< / xsl:choose >
< ext:ProtectionOrderStatusDate > ;
< xsl:value-of 选择 = mscef :formatDate(string($ vStatusDate)) / >
< / ext:ProtectionOrderStatusDate >
< / ext:ProtectionOrderStatus >

< msxsl:script language = JScript implements-prefix = mscef > <![CDATA [
函数currentDateTime(){
var oDate = new Date();
返回formatDateTime(oDate.toString());
}
function formatTime(sTime){
if(sTime.length == 0){
return;
}
else {
var oDate = new Date(sTime);
var str = oDate.getSeconds();
返回padZeroes(oDate.getHours()。toString(),2)+:+ padZeroes(oDate.getMinutes(),2)+:+ padZeroes(oDate.getSeconds(),2)+ - + padZeroes(oDate.getTimezoneOffset()/ 60,2)+:00;
}
}
函数formatDate(sDate){
if(sDate.length == 0){
return;
}
else {
var oDate = new Date(sDate);
var str = oDate.getSeconds();
返回oDate.getFullYear()+ - + padZeroes(oDate.getMonth()+ 1,2)+ - + padZeroes(oDate.getDate(),2);
}
}
函数formatDateTime(sDate){
if(sDate.length == 0){
return;
}
else {
var oDate = new Date(sDate);
var str = oDate.getSeconds();
return oDate.getFullYear() + \"-\" + padZeroes(oDate.getMonth() + 1,2) + \"-\" + padZeroes(oDate.getDate(),2) + \"T\" + padZeroes(oDate.getHours().toString(),2) + \":\" + padZeroes(oDate.getMinutes(),2) + \":\" + padZeroes(oDate.getSeconds(),2) + \"-\" + padZeroes(oDate.getTimezoneOffset() / 60,2) + \":00\";
}
}
\t\tfunction formatDateTimeNumeric(sDate){
\t\t\tif(sDate.length==0){
\t\t\t\treturn \"\";
\t\t\t}
\t\t\telse{
\t\t\t\tvar oDate=new Date(sDate);
\t\t\t\tvar str = oDate.getSeconds();
\t\t\t\treturn \"\" + oDate.getFullYear().toString() + padZeroes(oDate.getMonth() + 1,2) + padZeroes(oDate.getDate(),2) + padZeroes(oDate.getHours().toString(),2) + padZeroes(oDate.getMinutes(),2) + padZeroes(oDate.getSeconds(),2);
\t\t\t}
\t\t}
\t\tfunction currentDateTimeNumeric(){
\t\t\t\tvar oDate=new Date();
\t\t\t\tvar str = oDate.getSeconds();
\t\t\t\treturn \"\" + oDate.getFullYear().toString() + padZeroes(oDate.getMonth() + 1,2) + padZeroes(oDate.getDate(),2) + padZeroes(oDate.getHours().toString(),2) + padZeroes(oDate.getMinutes(),2) + padZeroes(oDate.getSeconds(),2);
\t\t}\t
\t\t
\t\tfunction fixOdysseyTimestamp(sDate){
\t\t/* Replace the \":\" between seconds and miliseconds */
\t\t\tif(sDate.length==0){
\t\t\t\treturn \"\";
\t\t\t}
\t\t\telse{
\t\t\t\tvar strParts1 = sDate.split(\" \");
\t\t\t\tvar strTime = strParts1[1];
\t\t\t\tvar strParts2 = strTime.split(\":\");
\t\t\t\treturn strParts1[0] + \" \" + strParts2[0] + \":\" + strParts2[1] + \":\" + strParts2[2];
\t\t\t}
\t\t}
\t
]]>

\t</msxsl:script>
</xsl:stylesheet>

解决方案

vCurrentTimestamp][1]/Date\"/>
\t\t\t<xsl:variable name=\"vStatusWord\" select=\"Statuses/Status[mscef:formatDateTimeNumeric(mscef :fixOdysseyTimestamp(string(TimestampCreate))) <=


vCurrentTimestamp][1]/Type/@Word\"/>
\t\t\t<ext:ProtectionOrderStatus>
\t\t\t\t<xsl:choose>
\t\t\t\t\t<xsl:when test=\"Deleted='true'\">
\t\t\t\t\t\t<ext:ProtectionOrderStatusCode>DELETED</ext:ProtectionOrderStatusCode>
\t\t\t\t\t</xsl:when>
\t\t\t\t<xsl:otherwise>
\t\t\t\t\t\t<xsl:value-of select=\"


vStatusWord\"/>
\t\t\t\t\t</xsl:otherwise>
\t\t\t\t</xsl:choose>
\t\t\t\t<ext:ProtectionOrderStatusDate>
\t\t\t\t\t<xsl:value-of select=\"mscef:formatDate(string(


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

<?xml version="1.0" encoding="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">
    <!--ext:ProtectionOrderStatus-->
    			<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[
    		  function currentDateTime(){
       var oDate=new Date();
       return formatDateTime(oDate.toString());
      }
      function formatTime(sTime){
       if(sTime.length==0){
        return "";
       }
       else{
        var oDate=new Date(sTime);
        var str = oDate.getSeconds();
        return padZeroes(oDate.getHours().toString(),2) + ":"  +  padZeroes(oDate.getMinutes(),2) + ":" +  padZeroes(oDate.getSeconds(),2) + "-" + padZeroes(oDate.getTimezoneOffset() / 60,2) + ":00";     
       }
      }
      function formatDate(sDate){
       if(sDate.length==0){
        return "";
       }
       else{
        var oDate=new Date(sDate);
        var str = oDate.getSeconds();
        return oDate.getFullYear() + "-" +  padZeroes(oDate.getMonth() + 1,2) + "-" +  padZeroes(oDate.getDate(),2);     
       }
      }
      function formatDateTime(sDate){
       if(sDate.length==0){
        return "";
       }
       else{
        var oDate=new Date(sDate);
        var str = oDate.getSeconds();
        return oDate.getFullYear() + "-" +  padZeroes(oDate.getMonth() + 1,2) + "-" +  padZeroes(oDate.getDate(),2) + "T" + padZeroes(oDate.getHours().toString(),2) + ":"  +  padZeroes(oDate.getMinutes(),2) + ":" +  padZeroes(oDate.getSeconds(),2) + "-" + padZeroes(oDate.getTimezoneOffset() / 60,2) + ":00";     
       }
      }
    		function formatDateTimeNumeric(sDate){
    			if(sDate.length==0){
    				return "";
    			}
    			else{
    				var oDate=new Date(sDate);
    				var str = oDate.getSeconds();
    				return "" + oDate.getFullYear().toString() + padZeroes(oDate.getMonth() + 1,2) + padZeroes(oDate.getDate(),2) + padZeroes(oDate.getHours().toString(),2) + padZeroes(oDate.getMinutes(),2) + padZeroes(oDate.getSeconds(),2);  			
    			}
    		}
    		function currentDateTimeNumeric(){
    				var oDate=new Date();
    				var str = oDate.getSeconds();
    				return "" + oDate.getFullYear().toString() + padZeroes(oDate.getMonth() + 1,2) + padZeroes(oDate.getDate(),2) + padZeroes(oDate.getHours().toString(),2) + padZeroes(oDate.getMinutes(),2) + padZeroes(oDate.getSeconds(),2);  			
    		}	
    		
    		function fixOdysseyTimestamp(sDate){
    		/* Replace the ":" between seconds and miliseconds */
    			if(sDate.length==0){
    				return "";
    			}
    			else{
    				var strParts1 = sDate.split(" ");
    				var strTime = strParts1[1];
    				var strParts2 = strTime.split(":");
    				return strParts1[0] + " " + strParts2[0] + ":" + strParts2[1] + ":" + strParts2[2];
    			}
    		}
    	]]>
    	</msxsl:script>  
    </xsl:stylesheet>



What I have tried:

<?xml version="1.0" encoding="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">
    <!--ext:ProtectionOrderStatus-->
    			<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[
    		  function currentDateTime(){
       var oDate=new Date();
       return formatDateTime(oDate.toString());
      }
      function formatTime(sTime){
       if(sTime.length==0){
        return "";
       }
       else{
        var oDate=new Date(sTime);
        var str = oDate.getSeconds();
        return padZeroes(oDate.getHours().toString(),2) + ":"  +  padZeroes(oDate.getMinutes(),2) + ":" +  padZeroes(oDate.getSeconds(),2) + "-" + padZeroes(oDate.getTimezoneOffset() / 60,2) + ":00";     
       }
      }
      function formatDate(sDate){
       if(sDate.length==0){
        return "";
       }
       else{
        var oDate=new Date(sDate);
        var str = oDate.getSeconds();
        return oDate.getFullYear() + "-" +  padZeroes(oDate.getMonth() + 1,2) + "-" +  padZeroes(oDate.getDate(),2);     
       }
      }
      function formatDateTime(sDate){
       if(sDate.length==0){
        return "";
       }
       else{
        var oDate=new Date(sDate);
        var str = oDate.getSeconds();
        return oDate.getFullYear() + "-" +  padZeroes(oDate.getMonth() + 1,2) + "-" +  padZeroes(oDate.getDate(),2) + "T" + padZeroes(oDate.getHours().toString(),2) + ":"  +  padZeroes(oDate.getMinutes(),2) + ":" +  padZeroes(oDate.getSeconds(),2) + "-" + padZeroes(oDate.getTimezoneOffset() / 60,2) + ":00";     
       }
      }
    		function formatDateTimeNumeric(sDate){
    			if(sDate.length==0){
    				return "";
    			}
    			else{
    				var oDate=new Date(sDate);
    				var str = oDate.getSeconds();
    				return "" + oDate.getFullYear().toString() + padZeroes(oDate.getMonth() + 1,2) + padZeroes(oDate.getDate(),2) + padZeroes(oDate.getHours().toString(),2) + padZeroes(oDate.getMinutes(),2) + padZeroes(oDate.getSeconds(),2);  			
    			}
    		}
    		function currentDateTimeNumeric(){
    				var oDate=new Date();
    				var str = oDate.getSeconds();
    				return "" + oDate.getFullYear().toString() + padZeroes(oDate.getMonth() + 1,2) + padZeroes(oDate.getDate(),2) + padZeroes(oDate.getHours().toString(),2) + padZeroes(oDate.getMinutes(),2) + padZeroes(oDate.getSeconds(),2);  			
    		}	
    		
    		function fixOdysseyTimestamp(sDate){
    		/* Replace the ":" between seconds and miliseconds */
    			if(sDate.length==0){
    				return "";
    			}
    			else{
    				var strParts1 = sDate.split(" ");
    				var strTime = strParts1[1];
    				var strParts2 = strTime.split(":");
    				return strParts1[0] + " " + strParts2[0] + ":" + strParts2[1] + ":" + strParts2[2];
    			}
    		}
    	]]>
    	</msxsl:script>  
    </xsl:stylesheet>

解决方案

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(


这篇关于如何更新我的XSLT以显示正确的输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆