Mercurial > hg > mpdl-group
view 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 |
line wrap: on
line source
xquery version "1.0"; import module namespace mpdl-time = "http://www.mpiwg-berlin.mpg.de/ns/mpdl/util/time" at "../util/time.xql"; declare namespace request="http://exist-db.org/xquery/request"; let $fromCoding := request:get-parameter("from-encoding", "") let $toCoding := request:get-parameter("to-encoding", "") let $inputString := request:get-parameter("input-string", "") let $currentTimeBegin := util:system-time() let $encodedStr := mpdltext:transcode($fromCoding, $toCoding, $inputString) let $currentTimeEnd := util:system-time() let $neededTime := mpdl-time:duration-as-ms($currentTimeEnd - $currentTimeBegin) let $retHtmlResult := <html> <head> <title>Mpdl language technology</title> </head> <body> <h3>Mpdl language technology: Result of your query: from-encoding={$fromCoding}, to-encoding={$toCoding}</h3> <b>Your input string:</b> <p/> {$inputString} <p/> <b>Encoded string:</b> <p/> {$encodedStr} <hr/> <p/> 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> </body> </html> let $declare := util:declare-option("exist:serialize", "method=xml media-type=text/xml omit-xml-declaration=no indent=yes encoding=utf-8") return <result> <query> <from-encoding>{$fromCoding}</from-encoding> <to-encoding>{$toCoding}</to-encoding> <input-string>{$inputString}</input-string> </query> <encoded-string>{$encodedStr}</encoded-string> </result>