<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16481" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2>Given a startTime 
(dateTime), endTime (dateTime) and intervals (integer), I'm attempting to come 
up with dateTimes evenly spaced between the startTime and endTime.&nbsp; It 
seems that I need to use xquery-operators to do this since XSLT doesn't seem to 
provide the kind of date manipulation I need.&nbsp; When I try to run this, I 
get an error (also below).&nbsp;</FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2>Am I going about 
this the correct way, or is there a better way to do this?&nbsp; Does JDOM 
provide support for xquery-operators in XSLT?&nbsp; If not, is there another way 
to get these time intervals?&nbsp; Or should I be using another processor for 
this?&nbsp; On a slightly related node, position() works, but fn:position() 
doesn't.&nbsp; Is this a XSLT 1.0 vs 2.0 thing?</FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial 
size=2>Thanks,</FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial 
size=2>Charles</FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial 
size=2>&lt;-------------ERROR----------------&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2>ERROR:&nbsp; 'The 
first argument to the non-static Java function 'subtractDateTimes' is not a 
valid object reference.'<BR>FATAL ERROR:&nbsp; 'Could not compile 
stylesheet'<BR>org.jdom.transform.XSLTransformException: Could not construct 
XSLTransformer: Could not compile stylesheet</FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial 
size=2>&lt;--------------------STYLESHEET----------------------------&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2>&lt;?xml 
version="1.0" encoding="UTF-8"?&gt;<BR>&lt;xsl:stylesheet 
version="1.0"<BR>&nbsp;xmlns:xsl="<A 
href="http://www.w3.org/1999/XSL/Transform">http://www.w3.org/1999/XSL/Transform</A>"<BR>&nbsp;xmlns:sgp4="<A 
href="http://sever/common/sgp4">http://sever/common/sgp4</A>"<BR>&nbsp;xmlns:fn="<A 
href="http://www.w3.org/2005/02/xpath-functions">http://www.w3.org/2005/02/xpath-functions</A>"<BR>&nbsp;xmlns:op="<A 
href="http://www.w3.org/2001/12/xquery-operators">http://www.w3.org/2001/12/xquery-operators</A>"<BR>&nbsp;xmlns:xs="<A 
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"&gt;<BR>&lt;xsl:output 
method="xml" /&gt;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2>&lt;xsl:variable 
name="startTime" select="sgp4:SGP4Set/sgp4:startDateTime" 
/&gt;<BR>&lt;xsl:variable name="endTime"&nbsp;&nbsp; 
select="sgp4:SGP4Set/sgp4:stopDateTime" /&gt;<BR>&lt;xsl:variable 
name="steps"&nbsp;&nbsp;&nbsp;&nbsp; select="sgp4:SGP4Set/sgp4:steps" 
/&gt;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2>&lt;xsl:template 
match="/"&gt;<BR>&nbsp;&lt;result&gt;<BR>&nbsp;&nbsp;&lt;xsl:apply-templates 
/&gt;<BR>&nbsp;&lt;/result&gt;<BR>&lt;/xsl:template&gt;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2>&lt;xsl:template 
match="sgp4:timeSeries"&gt;<BR>&nbsp;&lt;xsl:apply-templates/&gt;<BR>&lt;/xsl:template&gt;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2>&lt;xsl:template 
match="sgp4:SGP4Set/sgp4:timeSeries/sgp4:latLonXYZ"&gt;<BR>&nbsp;&lt;timeLocation&gt;<BR>&nbsp;&nbsp;&lt;xsl:value-of 
select="$startTime + (position() * (op:subtract-dateTimes($startTime, $endTime) 
div 
steps))"/&gt;<BR>&nbsp;&lt;/timeLocation&gt;<BR>&lt;/xsl:template&gt;</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial 
size=2>&lt;/xsl:stylesheet&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial 
size=2>&lt;------------------------------CODE--------------------------------&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2>I'm then trying to 
transform it with the following code:</FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2>&nbsp;&nbsp;String 
str = "&lt;SGP4Set&gt;" + <BR>&nbsp; 
"&lt;startDateTime&gt;2007-06-14T15:21:10.666+00:00&lt;/startDateTime&gt;" + 
<BR>&nbsp; 
"&lt;stopDateTime&gt;2007-06-15T15:21:10.666+00:00&lt;/stopDateTime&gt;" + 
<BR>&nbsp; "&lt;steps&gt;3&lt;/steps&gt;" + <BR>&nbsp; "&lt;elsetLine1&gt;1 
25544U 98067A&nbsp;&nbsp; 07164.33827071 -.00073317&nbsp; 00000-0 -41936-3 
0&nbsp; 3835&lt;/elsetLine1&gt;" + <BR>&nbsp; "&lt;elsetLine2&gt;2 25544 
051.6334 123.8003 0008065 317.7457 198.0340 
15.78097880490162&lt;/elsetLine2&gt;" + <BR>&nbsp; "&lt;timeSeries&gt;" + 
<BR>&nbsp;&nbsp;&nbsp; "&lt;latLonXYZ lat=\"-4.464837391096287\" 
lon=\"340.6854284795686\" height=\"333.1668901789984\" x=\"-2673.3476456175044\" 
y=\"6133.803881468676\" z=\"-519.1427930784305\" 
time=\"1874.1666666665114\"/&gt;" + <BR>&nbsp;&nbsp;&nbsp; "&lt;latLonXYZ 
lat=\"4.510324008580091\" lon=\"347.0371991370784\" 
height=\"332.65914429961356\" x=\"-3407.888183523746\" y=\"5757.110331891201\" 
z=\"524.3810905059737\" time=\"1877.0466666665116\"/&gt;" + 
<BR>&nbsp;&nbsp;&nbsp; "&lt;latLonXYZ lat=\"13.413484560305426\" 
lon=\"353.56508317710467\" height=\"333.1856535368585\" x=\"-4008.464009082425\" 
y=\"5154.103666587921\" z=\"1547.231195854609\" 
time=\"1879.9266666665117\"/&gt;" +&nbsp;<BR>&nbsp; "&lt;/timeSeries&gt;" 
+<BR>"&lt;/SGP4Set&gt;";</FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;// 
setup our transformer <BR>&nbsp;&nbsp;&nbsp;SAXBuilder builder = new 
SAXBuilder();<BR>&nbsp;&nbsp;&nbsp;XSLTransformer transformer = new 
XSLTransformer("SGP4ToKML.xslt");</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;// 
setup our document to transform<BR>&nbsp;&nbsp;&nbsp;StringReader sr = new 
StringReader(str);<BR>&nbsp;&nbsp;&nbsp;Document doc = 
builder.build(sr);<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;// save the 
transformed document in doc2<BR>&nbsp;&nbsp;&nbsp;Document doc2 = 
transformer.transform(doc);<BR></FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial 
size=2>&nbsp;&nbsp;&nbsp;String result = new 
XMLOutputter().outputString(doc);<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;result 
= new 
XMLOutputter().outputString(doc2);<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;XmlObject 
obj = 
XmlObject.Factory.parse(result);<BR>&nbsp;&nbsp;&nbsp;System.out.println(obj);</FONT></SPAN></DIV></BODY></HTML>