Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare function conv:stdSplit($uri as xs:string, $x as node()) {
- let $olduri := fn:concat($uri, "/", $x/dc:identifier[1], ".xml")
- let $newuri := fn:replace($olduri, "\.", "_")
- return
- <xinclude href="{$newuri}"/>
- };
- declare function conv:pstdSplit($uri as xs:string, $x as node()) {
- let $olduri := fn:concat($uri, "/", $x/dc:identifier[1], ".xml")
- let $newuri := fn:replace($olduri, "\.", "_")
- return
- <xinclude href="{$newuri}"/>
- };
- declare function conv:objSplit($uri as xs:string, $x as node()) {
- let $olduri := fn:concat($uri, "/", $x/dcterms:hasPart[1], "x.xml")
- let $newuri := fn:replace($olduri, "\.", "_")
- return
- <xinclude href="{$newuri}"/>
- };
- declare function conv:doctypeSplit($x as node()) {
- typeswitch ($x)
- (: put $x in /content/doctype/*.xml :)
- (: build an xinclude for this doc :)
- case element(pce:standards) return
- let $newuri := fn:concat("/content/",fn:local-name($x))
- return
- element {fn:name($x)}
- {
- $x/@*,
- for $z in $x/node() return
- conv:stdSplit($newuri, $z)
- }
- case element(pce:partialStandards) return
- let $newuri := fn:concat("/content/",fn:local-name($x))
- return
- element {fn:name($x)}
- {
- $x/@*,
- for $z in $x/node() return
- conv:pstdSplit($newuri, $z)
- }
- case element(pce:objectives) return
- let $newuri := fn:concat("/content/",fn:local-name($x))
- return
- element {fn:name($x)}
- {
- $x/@*,
- for $z in $x/node() return
- conv:objSplit($newuri, $z)
- }
- default return ($x)
- };
- declare function conv:lessonFrameSplit($x as node()) {
- typeswitch ($x)
- (: put $x in /content/doctype/*.xml :)
- (: build an xinclude for this doc :)
- case element(pce:LessonFrame) return
- element {fn:name($x)}
- {
- $x/@*,
- for $z in $x/node() return
- conv:doctypeSplit($z)
- }
- default return ($x)
- };
Add Comment
Please, Sign In to add comment