You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by David Parker <dl...@facstaff.wisc.edu> on 2000/09/29 19:23:23 UTC
sort using regular expressions
I'm trying to generate a class course grip sorted on starttime and pattern
(MTWRF) days of the week. (see XML file)
Where the class information would be saved to a gridArray.
TIME Monday Tuesday Wednesday
Thursday Friday
07:45 AM
08:35 AM
08:50 AM PSYCH 202
LEC PSYCH 202
LEC PSYCH 202 LEC
09:40 AM 08:50 AM - 09:40
AM 08:50 AM - 09:40
AM 08:50 AM - 09:40 AM
105 PSYCHOLOGY 105
PSYCHOLOGY 105 PSYCHOLOGY
09:55 AM MATH 340
LEC MATH 340
LEC MATH 340 LEC
10:45 AM 09:55 AM - 10:45
AM 09:55 AM - 10:45
AM 09:55 AM - 10:45 AM
B123 VAN VLECK B123 VAN
VLECK B123 VAN VLECK
11:00 AM COMP SCI 352 LEC ASIAN AM 101
LEC COMP SCI 352 LEC ASIAN AM 101 LEC COMP SCI
352 LEC
11:50 AM 11:00 AM - 12:15 PM 11:00 AM - 12:15
PM 11:00 AM - 12:15 PM 11:00 AM - 12:15 PM 11:00 AM -
12:15 PM
2650 HUMANITIES 222 INGRAHAM 2650
HUMANITIES 222 INGRAHAM 2650 HUMANITIES
------------------------------------------------------------------------
I was hoping to use Java extensions
(xmlns:java="http://xml.apache.org/xslt/java") and Java Regular Expressions
to parse the
starttime and pattern strings.
<java:variable rxM ="java.util.RegExp.new( M )"/>
<java:variable testsituation="rxM.execute(schedule/pattern)"/>
<xls:if test="testsituation">
...
then save the cell = '<td align="CENTER" valign="MIDDLE"><FONT
SIZE="-2">PSYCH 202 LEC<BR>08:50 AM - 09:40 AM<BR>105 PSYCHOLOGY</font></td>'
gridArray[i][j]= cell;
...
</xsl:if>
------------------------------------------------------------------------
Does this seem passable?
Or is there a sort() that can handle this?
59171 PSYCH 202 LEC (3 credits) 12/19/2000 08:50 PM - 09:40 AM, Location
not specified.
--------------- XML file ---------------------------------------
<classes>
<term>
<class>
<description></description>
<course>
<description></description>
<subject>PSYCH</subject>
<catalognumber>59171</catalognumber>
<units>3</units>
<section></section>
<component></component>
<sessioncode>202</sessioncode>
</course>
<facility>
<description></description>
<room>105</room>
<building>PSYCHOLOGY</building>
</facility>
<schedule>
<startdate>9/6/2000</startdate>
<enddate>12/19/2000</enddate>
<starttime>08:50 PM</starttime>
<endtime>09:40 PM</endtime>
<pattern>MWF</pattern>
</schedule>
<exam>
<timecode></timecode>
<schedule></schedule>
<facility></facility>
</exam>
<grade></grade>
</class>
</term>
</classes>
Sincerely,
David Parker
mailto:david.parker@doit.wisc.edu
Library, Instructional & Retrieval Applications,
DoIT - University of Wisconsin-Madison
1210 West Dayton Street, Madison WI 53706
Phone: 608.265.7829 FAX: 608.265-6453