comparison software/eXist/webapp/mpdl/lt/encoder.xql @ 7:5589d865af7a

Erstellung XQL/XSL Applikation
author Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de>
date Tue, 08 Feb 2011 15:16:46 +0100
parents
children
comparison
equal deleted inserted replaced
6:2396a569e446 7:5589d865af7a
1 xquery version "1.0";
2
3 import module namespace mpdl-time = "http://www.mpiwg-berlin.mpg.de/ns/mpdl/util/time" at "../util/time.xql";
4
5 declare namespace request="http://exist-db.org/xquery/request";
6
7 let $fromCoding := request:get-parameter("from-encoding", "")
8 let $toCoding := request:get-parameter("to-encoding", "")
9 let $inputString := request:get-parameter("input-string", "")
10
11 let $currentTimeBegin := util:system-time()
12
13 let $encodedStr := mpdltext:transcode($fromCoding, $toCoding, $inputString)
14 let $currentTimeEnd := util:system-time()
15 let $neededTime := mpdl-time:duration-as-ms($currentTimeEnd - $currentTimeBegin)
16
17 let $retHtmlResult :=
18 <html>
19 <head>
20 <title>Mpdl language technology</title>
21 </head>
22 <body>
23 <h3>Mpdl language technology: Result of your query: from-encoding={$fromCoding}, to-encoding={$toCoding}</h3>
24 <b>Your input string:</b>
25 <p/>
26 {$inputString}
27 <p/>
28 <b>Encoded string:</b>
29 <p/>
30 {$encodedStr}
31 <hr/>
32 <p/>
33 Elapsed time: {$neededTime} ms, see the <a href="/exist/xquery.xml">XQuery documentation</a> and the <a href="encoder.xql?_source=yes">XQuery source</a> of this page, if you find a bug <a href="https://itgroup.mpiwg-berlin.mpg.de:8080/tracs/mpdl-project-software/newticket">let us know</a>
34 </body>
35 </html>
36
37 let $declare := util:declare-option("exist:serialize", "method=xml media-type=text/xml omit-xml-declaration=no indent=yes encoding=utf-8")
38
39
40 return
41 <result>
42 <query>
43 <from-encoding>{$fromCoding}</from-encoding>
44 <to-encoding>{$toCoding}</to-encoding>
45 <input-string>{$inputString}</input-string>
46 </query>
47 <encoded-string>{$encodedStr}</encoded-string>
48 </result>