嗨,我正在使用Xalan来解析我的xsl文件。 xsl在vb.net解析器中正常工作。但是Xalan给出了那个xsl的错误。
For extension function, could not find
method
java.lang.String.FctDateDuration([ExpressionContext,]
STRING).
这里是我如何定义我的xsl。
xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:ttVB="ttVB" exclude-result这里是调用xsl的java脚本部分: -
xsl:value-of select="substring(DepartureDateTime,1,10)" />
xsl:variable name="end">
xsl:value-of select="substring(following-sibling::OriginDestinationInformation/DepartureDateTime,1,10)" />
xsl:variable name="end1">
xsl:value-of select="substring(preceding-sibling::OriginDestinationInformation/DepartureDateTime,1,10)" />
xsl:variable name="dd" select="ttVB:FctDateDuration(string('2011-02-20'),string('2011-02-25'))"/>
xsl:variable name="dd1" select="ttVB:FctDateDuration(string('2011-02-20'),string('2011-02-25'))"/>
xsl:when test="$dd = 0 or $dd = 1">
TA
xsl:otherwise>
timeQualifier>TD
这是我的Javascript
function FctDateDuration(p_startDate,p_endDate){
if (IsDate(p_startDate) && IsDate(p_endDate)){
FctDateDuration = String(calcDays(p_startDate, p_endDate))
}else{
FctDateDuration = p_startDate + p_endDate
}
return FctDateDuration;
}
function IsDate(ddate){
//alert("Inside IsDate >> "+ddate);
var dteDate;
var year = ddate.substring(0, 4);
var month = ddate.substring(5, 7);
var day = ddate.substring(8,10);
month = month-1;
//alert(year);
//alert(month);
//alert(day);
dteDate=new Date(year,month,day);
return ((day==dteDate.getDate()) && (month==dteDate.getMonth()) && (year==dteDate.getFullYear()));
}
function calcDays(date1,date2){
date1 = date1.split("-");
date2 = date2.split("-");
var sDate = new Date(date1[0]+"/"+date1[1]+"/"+date1[2]);
var eDate = new Date(date2[0]+"/"+date2[1]+"/"+date2[2]);
var daysApart = Math.abs(Math.round((sDate-eDate)/86400000));
//document.getElementById('diffDays').lastChild.data = daysApart;
//alert(daysApart);
return daysApart;
}
]]>