2 <xsl:stylesheet version=
"1.0"
3 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform">
4 <xsl:output method=
"xml" encoding=
"UTF-8" />
5 <xsl:template match=
"/">
8 <NAME>backup-from-blackboard.zip
</NAME>
9 <MOODLE_VERSION>2004083100</MOODLE_VERSION>
10 <MOODLE_RELEASE>1.4</MOODLE_RELEASE>
11 <BACKUP_VERSION>2004083100</BACKUP_VERSION>
12 <BACKUP_RELEASE>1.4</BACKUP_RELEASE>
13 <DATE>1094240862</DATE>
14 <ORIGINAL_WWWROOT>INSERT URL HERE
</ORIGINAL_WWWROOT>
17 <NAME>assignment
</NAME>
18 <INCLUDED>true
</INCLUDED>
19 <USERINFO>true
</USERINFO>
23 <INCLUDED>true
</INCLUDED>
24 <USERINFO>true
</USERINFO>
28 <INCLUDED>true
</INCLUDED>
29 <USERINFO>true
</USERINFO>
33 <INCLUDED>true
</INCLUDED>
34 <USERINFO>true
</USERINFO>
38 <INCLUDED>true
</INCLUDED>
39 <USERINFO>true
</USERINFO>
43 <INCLUDED>true
</INCLUDED>
44 <USERINFO>true
</USERINFO>
48 <INCLUDED>true
</INCLUDED>
49 <USERINFO>true
</USERINFO>
53 <INCLUDED>true
</INCLUDED>
54 <USERINFO>true
</USERINFO>
58 <INCLUDED>true
</INCLUDED>
59 <USERINFO>true
</USERINFO>
63 <INCLUDED>true
</INCLUDED>
64 <USERINFO>true
</USERINFO>
68 <INCLUDED>true
</INCLUDED>
69 <USERINFO>true
</USERINFO>
73 <INCLUDED>true
</INCLUDED>
74 <USERINFO>true
</USERINFO>
78 <INCLUDED>true
</INCLUDED>
79 <USERINFO>true
</USERINFO>
83 <INCLUDED>true
</INCLUDED>
84 <USERINFO>true
</USERINFO>
88 <USERFILES>true
</USERFILES>
89 <COURSEFILES>true
</COURSEFILES>
93 <!-- Get course specific information -->
94 <xsl:apply-templates select=
"document('res00001.dat')//COURSE"/>
96 <xsl:call-template name=
"modules" />
99 <!-- Create a title section -->
100 <xsl:for-each select=
"document('res00001.dat')" >
101 <xsl:call-template name=
"title_section" />
105 <!-- Create a topic for each top level Bb item and add section modules ONE folder deep -->
106 <xsl:for-each select=
"manifest/organizations/organization/item">
107 <xsl:variable name=
"section_number" select=
"position()"/>
108 <xsl:call-template name=
"sections">
109 <xsl:with-param name=
"section_number" select=
"$section_number"/>
110 <xsl:with-param name=
"recurse" >false
</xsl:with-param>
114 <!-- Create a topic for each second level Bb item which is a folder, recursively make section modules -->
115 <xsl:for-each select=
"manifest/organizations/organization/item/item">
116 <xsl:sort order=
"descending" select=
"document(concat(@identifierref,'.dat'))/CONTENT/FLAGS/ISFOLDER/@value"/>
117 <xsl:if test=
"document(concat(@identifierref,'.dat'))/CONTENT/FLAGS/ISFOLDER/@value = 'true'">
118 <xsl:variable name=
"prev_sections" select=
"count(/manifest/organizations/tableofcontents/item)"/>
119 <xsl:variable name=
"section_number" select=
"position()+$prev_sections"/>
120 <xsl:call-template name=
"sections">
121 <xsl:with-param name=
"section_number" select=
"$section_number"/>
122 <xsl:with-param name=
"recurse" >true
</xsl:with-param>
132 <xsl:template match=
"COURSE">
137 <NAME><xsl:value-of select=
"CATEGORIES/CATEGORY/@value"/></NAME>
139 <PASSWORD></PASSWORD>
140 <IDNUMBER>4</IDNUMBER>
141 <FORMAT>topics
</FORMAT>
142 <SHOWGRADES>1</SHOWGRADES>
143 <BLOCKINFO>participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity
</BLOCKINFO>
144 <NEWSITEMS>5</NEWSITEMS>
145 <TEACHER>Teacher
</TEACHER>
146 <TEACHERS>Teachers
</TEACHERS>
147 <STUDENT>Student
</STUDENT>
148 <STUDENTS>Students
</STUDENTS>
150 <STARTDATE>1094270400</STARTDATE>
151 <ENROLPERIOD>0</ENROLPERIOD>
152 <NUMSECTIONS>10</NUMSECTIONS>
153 <MAXBYTES>2097152</MAXBYTES>
154 <SHOWREPORTS>0</SHOWREPORTS>
155 <GROUPMODE>0</GROUPMODE>
156 <GROUPMODEFORCE>0</GROUPMODEFORCE>
161 <HIDDENSECTIONS>0</HIDDENSECTIONS>
162 <TIMECREATED>1094240775</TIMECREATED>
163 <TIMEMODIFIED>1094240775</TIMEMODIFIED>
164 <SUMMARY><xsl:value-of select=
"DESCRIPTION"/></SUMMARY>
165 <SHORTNAME><xsl:value-of select=
"COURSEID/@value"/></SHORTNAME>
166 <FULLNAME><xsl:value-of select=
"TITLE/@value"/></FULLNAME>
170 <xsl:template name=
"title_section" match=
"resource">
174 <SUMMARY><div
style=
"text-align: center;"><font
size=
"5" style=
"font-family: arial,helvetica,sans-serif;"><xsl:value-of select=
"COURSE/TITLE/@value"/></font
></div
>
175 <xsl:value-of select=
"COURSE/DESCRIPTION"/>
183 <xsl:template name=
"sections" match=
"resource">
184 <xsl:param name=
"section_number">1.
</xsl:param>
185 <xsl:param name=
"recurse"/>
187 <ID><xsl:value-of select=
"$section_number"/></ID>
188 <NUMBER><xsl:value-of select=
"$section_number"/></NUMBER>
189 <SUMMARY><span
style=
"font-weight: bold;"><xsl:value-of select=
"title"/></span
></SUMMARY>
193 <xsl:if test=
"$recurse = 'true'">
194 <xsl:variable name=
"mod_number" select=
"substring-after(@identifierref,'res')"/>
195 <xsl:call-template name=
"item_recurse_files" >
196 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
197 <xsl:with-param name=
"indent" >0</xsl:with-param>
198 <xsl:with-param name=
"recurse" select=
"$recurse" />
203 <xsl:if test=
"$recurse = 'false'">
204 <xsl:for-each select=
"item">
205 <xsl:variable name=
"mod_number" select=
"substring-after(@identifierref,'res')"/>
206 <xsl:call-template name=
"item" >
207 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
208 <xsl:with-param name=
"indent" >0</xsl:with-param>
218 <xsl:template name=
"item_recurse_files">
219 <xsl:param name=
"mod_number">1.
</xsl:param>
220 <xsl:param name=
"indent">1.
</xsl:param>
221 <xsl:param name=
"recurse"/>
224 <!-- Create one section-mod -->
225 <xsl:for-each select=
"document(concat(@identifierref,'.dat'))">
226 <xsl:call-template name=
"section_mod">
227 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
228 <xsl:with-param name=
"indent" select=
"$indent"/>
232 <!-- Depth first recursion to preserve order -->
233 <xsl:for-each select=
"item">
234 <xsl:variable name=
"m_number" select=
"substring-after(@identifierref,'res')"/>
235 <xsl:call-template name=
"item_recurse_files" >
236 <xsl:with-param name=
"mod_number" select=
"$m_number"/>
237 <xsl:with-param name=
"indent" select=
"$indent + 1"/>
243 <xsl:template name=
"item">
244 <xsl:param name=
"mod_number">1.
</xsl:param>
245 <xsl:param name=
"indent">1.
</xsl:param>
248 <xsl:if test=
"document(concat(@identifierref,'.dat'))/CONTENT/FLAGS/ISFOLDER/@value != 'true' or document(concat(@identifierref,'.dat'))/EXTERNALLINK/DESCRIPTION/FLAGS/ISHTML/@value ='true'">
249 <!-- Create one section-mod -->
250 <xsl:for-each select=
"document(concat(@identifierref,'.dat'))">
251 <xsl:call-template name=
"section_mod">
252 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
253 <xsl:with-param name=
"indent" select=
"$indent"/>
261 <!-- Determines the type of section mod entry and calls the appropriate creation template -->
262 <xsl:template name=
"section_mod" >
263 <xsl:param name=
"mod_number">1.
</xsl:param>
264 <xsl:param name=
"contenttype" />
265 <xsl:param name=
"indent">1.
</xsl:param>
267 <!-- Every file will have a label module describing it -->
269 <!-- Detected a file -->
270 <xsl:when test=
"CONTENT/FILE/@id != '' or CONTENT/FILES/FILE/NAME != ''">
271 <!-- Create a label -->
272 <xsl:call-template name=
"section_mod_label">
273 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
274 <xsl:with-param name=
"indent" select=
"$indent"/>
277 <!-- Create a resource -->
278 <xsl:call-template name=
"section_mod_resource">
279 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
280 <xsl:with-param name=
"indent" select=
"$indent"/>
285 <!-- Detected a folder -->
286 <xsl:when test=
"CONTENT/FLAGS/ISFOLDER/@value = 'true'">
287 <MAKINGLABEL></MAKINGLABEL>
288 <!-- Create a label -->
289 <xsl:call-template name=
"section_mod_label">
290 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
291 <xsl:with-param name=
"indent" select=
"$indent"/>
295 <!-- Detected text -->
296 <xsl:when test=
"CONTENT/MAINDATA/FLAGS/ISHTML/@value = 'true' or CONTENT/BODY/TYPE/@value = 'H' ">
297 <MAKINGTEXT></MAKINGTEXT>
298 <!-- Create a resource -->
299 <xsl:call-template name=
"section_mod_resource">
300 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
301 <xsl:with-param name=
"indent" select=
"$indent"/>
305 <!-- Detected external link -->
306 <xsl:when test=
"EXTERNALLINK/TITLE/@value != '' ">
307 <!-- Create a label -->
308 <xsl:call-template name=
"section_mod_label">
309 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
310 <xsl:with-param name=
"indent" select=
"$indent"/>
313 <!-- Create a resource -->
314 <xsl:call-template name=
"section_mod_externallink">
315 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
316 <xsl:with-param name=
"indent" select=
"$indent"/>
329 <!-- Creates one section-mod-label -->
330 <xsl:template name=
"section_mod_label" >
331 <xsl:param name=
"mod_number">1.
</xsl:param>
332 <xsl:param name=
"indent">1.
</xsl:param>
334 <ID>1<xsl:value-of select=
"$mod_number"/>0</ID>
337 <xsl:value-of select=
"CONTENT/TITLE"/>
339 <xsl:value-of select=
"CONTENT/TITLE/@value"/>
342 <INSTANCE><xsl:value-of select=
"$mod_number"/></INSTANCE>
343 <ADDED>1094240775</ADDED>
346 <INDENT><xsl:value-of select=
"$indent"/></INDENT>
348 <GROUPMODE>0</GROUPMODE>
353 <!-- Creates one section-mod-resource -->
354 <xsl:template name=
"section_mod_resource" >
355 <xsl:param name=
"mod_number">1.
</xsl:param>
356 <xsl:param name=
"indent">1.
</xsl:param>
358 <ID><xsl:value-of select=
"$mod_number"/>0</ID>
361 <xsl:value-of select=
"CONTENT/TITLE"/>
363 <xsl:value-of select=
"CONTENT/TITLE/@value"/>
365 <TYPE>resource
</TYPE>
366 <INSTANCE><xsl:value-of select=
"$mod_number"/></INSTANCE>
367 <ADDED>1094240775</ADDED>
370 <INDENT><xsl:value-of select=
"$indent"/></INDENT>
372 <GROUPMODE>0</GROUPMODE>
377 <!-- Creates one section-mod-externallink -->
378 <xsl:template name=
"section_mod_externallink" >
379 <xsl:param name=
"mod_number">1.
</xsl:param>
380 <xsl:param name=
"indent">1.
</xsl:param>
382 <ID><xsl:value-of select=
"$mod_number"/>0</ID>
384 <xsl:value-of select=
"EXTERNALLINK/TITLE/@value"/>
386 <TYPE>resource
</TYPE>
387 <INSTANCE><xsl:value-of select=
"$mod_number"/></INSTANCE>
388 <ADDED>1094240775</ADDED>
391 <INDENT><xsl:value-of select=
"$indent"/></INDENT>
393 <GROUPMODE>0</GROUPMODE>
398 <!-- Creates a module-label entry -->
399 <xsl:template name=
"module_label" >
400 <xsl:param name=
"mod_number">1.
</xsl:param>
402 <ID><xsl:value-of select=
"$mod_number"/></ID>
403 <MODTYPE>label
</MODTYPE>
405 <!-- for CONTENT text -->
406 <xsl:value-of select=
"TITLE"/>
407 <!-- for EXTERNALLINK text -->
408 <xsl:value-of select=
"TITLE/@value"/>
411 <span
style=
"font-style: italic;">
412 <!-- for CONTENT text -->
413 <xsl:value-of select=
"TITLE"/>
414 <!-- for EXTERNALLINK text -->
415 <xsl:value-of select=
"TITLE/@value"/>
417 <!-- for CONTENT text -->
418 <xsl:value-of select=
"MAINDATA/TEXT"/>
419 <!-- for EXTERNALLINK text -->
420 <xsl:value-of select=
"DESCRIPTION/TEXT"/>
421 <!-- for BB6 text -->
422 <xsl:value-of select=
"BODY/TEXT"/>
424 <TIMEMODIFIED>1094240775</TIMEMODIFIED>
428 <!-- Creates one module-file entry -->
429 <xsl:template name=
"module_file" >
430 <xsl:param name=
"mod_number">1.
</xsl:param>
431 <xsl:param name=
"identifier"/>
433 <ID><xsl:value-of select=
"$mod_number"/></ID>
434 <MODTYPE>resource
</MODTYPE>
437 <xsl:value-of select=
"FILES/FILEREF/RELFILE/@value"/>
439 <xsl:value-of select=
"FILES/FILE/NAME"/>
442 <REFERENCE><!-- BB5 --><xsl:value-of select=
"FILES/FILEREF/CONTENTID/@value"/><!-- BB6 --><xsl:value-of select=
"$identifier"/>/
<!-- BB5 --><xsl:value-of select=
"FILES/FILEREF/RELFILE/@value"/><!-- BB6 --><xsl:value-of select=
"FILES/FILE/NAME"/></REFERENCE>
444 <xsl:value-of select=
"MAINDATA/TEXT"/>
449 <TIMEMODIFIED>1094240775</TIMEMODIFIED>
453 <!-- Creates one module-text entry -->
454 <xsl:template name=
"module_text" >
455 <xsl:param name=
"mod_number">1.
</xsl:param>
457 <ID><xsl:value-of select=
"$mod_number"/></ID>
458 <MODTYPE>resource
</MODTYPE>
461 <xsl:value-of select=
"TITLE"/>
463 <xsl:value-of select=
"TITLE/@value"/>
466 <REFERENCE></REFERENCE>
469 <xsl:value-of select=
"TITLE"/>
471 <xsl:value-of select=
"TITLE/@value"/>
475 <xsl:value-of select=
"MAINDATA/TEXT"/>
477 <xsl:value-of select=
"BODY/TEXT"/>
481 <TIMEMODIFIED>1094240775</TIMEMODIFIED>
485 <!-- Creates one module-link entry -->
486 <xsl:template name=
"module_link" >
487 <xsl:param name=
"mod_number">1.
</xsl:param>
489 <ID><xsl:value-of select=
"$mod_number"/></ID>
490 <MODTYPE>resource
</MODTYPE>
492 <xsl:value-of select=
"URL/@value"/>
496 <xsl:value-of select=
"URL/@value"/>
499 <xsl:value-of select=
"TITLE/@value"/><br/
>
500 <xsl:value-of select=
"URL/@value"/>
503 <xsl:value-of select=
"DESCRIPTION/TEXT"/>
507 <TIMEMODIFIED>1094240775</TIMEMODIFIED>
511 <!-- Create a CONTENT module entries -->
512 <xsl:template match=
"EXTERNALLINK">
513 <xsl:param name=
"mod_number">1.
</xsl:param>
514 <!-- Every link module will have a label module describing it -->
515 <xsl:call-template name=
"module_label">
516 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
519 <xsl:call-template name=
"module_link">
520 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
525 <!-- Create a CONTENT module entries -->
526 <xsl:template match=
"CONTENT">
527 <xsl:param name=
"mod_number">1.
</xsl:param>
528 <xsl:param name=
"identifier"/>
533 <FILEFOUND></FILEFOUND>
535 <xsl:when test=
"FILES/FILE/@id != ''">
537 <!-- Every file module will have a label module describing it -->
538 <xsl:call-template name=
"module_label">
539 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
542 <xsl:call-template name=
"module_file">
543 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
544 <xsl:with-param name=
"identifier" select=
"$identifier"/>
549 <!-- Detected a folder
550 <FOLDERFOUND></FOLDERFOUND>
552 <xsl:when test=
"FLAGS/ISFOLDER/@value = 'true'">
554 <xsl:call-template name=
"module_label">
555 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
561 <TEXTFOUND></TEXTFOUND>
563 <xsl:when test=
"MAINDATA/FLAGS/ISHTML/@value = 'true' or BODY/TYPE/@value = 'H' ">
565 <xsl:call-template name=
"module_text">
566 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
573 <xsl:value-of select=
"TITLE"/>
581 <!-- Creates all module entries -->
582 <xsl:template name=
"modules" match=
"resource">
584 <xsl:for-each select=
"//resource">
585 <xsl:variable name=
"mod_number" select=
"substring-after(@identifier,'res')"/>
586 <xsl:variable name=
"identifier" select=
"@identifier"/>
587 <xsl:for-each select=
"document(concat(@identifier,'.dat'))">
588 <xsl:apply-templates select=
"//FORUM">
589 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
590 </xsl:apply-templates>
591 <xsl:apply-templates select=
"//CONTENT">
592 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
593 <xsl:with-param name=
"identifier" select=
"$identifier"/>
594 </xsl:apply-templates>
595 <xsl:apply-templates select=
"//EXTERNALLINK">
596 <xsl:with-param name=
"mod_number" select=
"$mod_number"/>
597 </xsl:apply-templates>
603 <!-- ############# Forum conversion ################# -->
605 <xsl:template match=
"FORUM">
606 <xsl:param name=
"mod_number">1.
</xsl:param>
608 <ID><xsl:value-of select=
"$mod_number"/></ID>
609 <MODTYPE>forum
</MODTYPE>
612 <xsl:value-of select=
"TITLE/@value"/>
615 <xsl:value-of select=
"DESCRIPTION/TEXT"/>
618 <ASSESSED>0</ASSESSED>
619 <ASSESSPUBLIC>0</ASSESSPUBLIC>
620 <ASSESSTIMESTART>0</ASSESSTIMESTART>
621 <ASSESSTIMEFINISH>0</ASSESSTIMEFINISH>
622 <MAXBYTES>0</MAXBYTES>
624 <FORCESUBSCRIBE>0</FORCESUBSCRIBE>
626 <RSSARTICLES>0</RSSARTICLES>
627 <TIMEMODIFIED></TIMEMODIFIED>
630 <xsl:for-each select="MESSAGETHREADS/MSG">
631 <xsl:variable name="discussion_id" select="position()"/>
634 <xsl:value-of select="$mod_number"/>0<xsl:value-of select="$discussion_id"/>
637 <xsl:value-of select="TITLE/@value"/>
639 <FIRSTPOST>2</FIRSTPOST>
641 <GROUPID>-1</GROUPID>
642 <ASSESSED>1</ASSESSED>
643 <TIMEMODIFIED>1094748430</TIMEMODIFIED>
644 <USERMODIFIED>1</USERMODIFIED>
646 <xsl:call-template name="MSG">
647 <xsl:with-param name="parent" select="0"/>
648 <xsl:with-param name="post_id">
649 <xsl:value-of select="$mod_number"/>0<xsl:value-of select="$discussion_id"/>0<xsl:value-of select="position()"/>
660 <xsl:template name=
"MSG" match=
"MSG">
661 <xsl:param name=
"parent" select=
"1"/>
662 <xsl:param name=
"post_id" select=
"1"/>
664 <ID><xsl:value-of select=
"$post_id"/></ID>
665 <PARENT> <xsl:value-of select=
"$parent"/></PARENT>
667 <CREATED>1094748430</CREATED>
668 <MODIFIED>1094748430</MODIFIED>
670 <SUBJECT><xsl:value-of select=
"TITLE/@value"/></SUBJECT>
671 <MESSAGE><xsl:value-of select=
"MESSAGETEXT"/></MESSAGE>
673 <ATTACHMENT></ATTACHMENT>
674 <TOTALSCORE>0</TOTALSCORE>
677 <xsl:for-each select=
"MSG">
678 <xsl:call-template name=
"MSG">
679 <xsl:with-param name=
"parent" select=
"$post_id"/>
680 <xsl:with-param name=
"post_id">
681 <xsl:value-of select=
"$post_id"/>0<xsl:value-of select=
"position()"/>