<!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. 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. When I try to run this, I
get an error (also below). </FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial
size=2></FONT></SPAN> </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? Does JDOM
provide support for xquery-operators in XSLT? If not, is there another way
to get these time intervals? Or should I be using another processor for
this? On a slightly related node, position() works, but fn:position()
doesn't. 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> </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> </DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial
size=2><-------------ERROR----------------></FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2>ERROR: 'The
first argument to the non-static Java function 'subtractDateTimes' is not a
valid object reference.'<BR>FATAL ERROR: '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> </DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial
size=2><--------------------STYLESHEET----------------------------></FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2><?xml
version="1.0" encoding="UTF-8"?><BR><xsl:stylesheet
version="1.0"<BR> xmlns:xsl="<A
href="http://www.w3.org/1999/XSL/Transform">http://www.w3.org/1999/XSL/Transform</A>"<BR> xmlns:sgp4="<A
href="http://sever/common/sgp4">http://sever/common/sgp4</A>"<BR> xmlns:fn="<A
href="http://www.w3.org/2005/02/xpath-functions">http://www.w3.org/2005/02/xpath-functions</A>"<BR> xmlns:op="<A
href="http://www.w3.org/2001/12/xquery-operators">http://www.w3.org/2001/12/xquery-operators</A>"<BR> xmlns:xs="<A
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"><BR><xsl:output
method="xml" /></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2><xsl:variable
name="startTime" select="sgp4:SGP4Set/sgp4:startDateTime"
/><BR><xsl:variable name="endTime"
select="sgp4:SGP4Set/sgp4:stopDateTime" /><BR><xsl:variable
name="steps" select="sgp4:SGP4Set/sgp4:steps"
/></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2><xsl:template
match="/"><BR> <result><BR> <xsl:apply-templates
/><BR> </result><BR></xsl:template></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2><xsl:template
match="sgp4:timeSeries"><BR> <xsl:apply-templates/><BR></xsl:template></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2><xsl:template
match="sgp4:SGP4Set/sgp4:timeSeries/sgp4:latLonXYZ"><BR> <timeLocation><BR> <xsl:value-of
select="$startTime + (position() * (op:subtract-dateTimes($startTime, $endTime)
div
steps))"/><BR> </timeLocation><BR></xsl:template></FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial
size=2></xsl:stylesheet></FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial
size=2><------------------------------CODE--------------------------------></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> String
str = "<SGP4Set>" + <BR>
"<startDateTime>2007-06-14T15:21:10.666+00:00</startDateTime>" +
<BR>
"<stopDateTime>2007-06-15T15:21:10.666+00:00</stopDateTime>" +
<BR> "<steps>3</steps>" + <BR> "<elsetLine1>1
25544U 98067A 07164.33827071 -.00073317 00000-0 -41936-3
0 3835</elsetLine1>" + <BR> "<elsetLine2>2 25544
051.6334 123.8003 0008065 317.7457 198.0340
15.78097880490162</elsetLine2>" + <BR> "<timeSeries>" +
<BR> "<latLonXYZ lat=\"-4.464837391096287\"
lon=\"340.6854284795686\" height=\"333.1668901789984\" x=\"-2673.3476456175044\"
y=\"6133.803881468676\" z=\"-519.1427930784305\"
time=\"1874.1666666665114\"/>" + <BR> "<latLonXYZ
lat=\"4.510324008580091\" lon=\"347.0371991370784\"
height=\"332.65914429961356\" x=\"-3407.888183523746\" y=\"5757.110331891201\"
z=\"524.3810905059737\" time=\"1877.0466666665116\"/>" +
<BR> "<latLonXYZ lat=\"13.413484560305426\"
lon=\"353.56508317710467\" height=\"333.1856535368585\" x=\"-4008.464009082425\"
y=\"5154.103666587921\" z=\"1547.231195854609\"
time=\"1879.9266666665117\"/>" + <BR> "</timeSeries>"
+<BR>"</SGP4Set>";</FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2> //
setup our transformer <BR> SAXBuilder builder = new
SAXBuilder();<BR> XSLTransformer transformer = new
XSLTransformer("SGP4ToKML.xslt");</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial size=2> //
setup our document to transform<BR> StringReader sr = new
StringReader(str);<BR> Document doc =
builder.build(sr);<BR> <BR> // save the
transformed document in doc2<BR> Document doc2 =
transformer.transform(doc);<BR></FONT></SPAN></DIV>
<DIV><SPAN class=568260313-20062007><FONT face=Arial
size=2> String result = new
XMLOutputter().outputString(doc);<BR> <BR> result
= new
XMLOutputter().outputString(doc2);<BR> <BR> XmlObject
obj =
XmlObject.Factory.parse(result);<BR> System.out.println(obj);</FONT></SPAN></DIV></BODY></HTML>