-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ndebeiss
committed
Jan 8, 2009
1 parent
fc4e130
commit 8d353c7
Showing
23 changed files
with
3,310 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
Copyright or © or Copr. INRIA contributor(s) : Nicolas Debeissat | ||
debeissat.nicolas@gmail.com | ||
This software is a computer program whose purpose is to generically | ||
generate web forms from a XML specification and, with that form, | ||
being able to generate the XML respecting that specification. | ||
This software is governed by the CeCILL license under French law and | ||
abiding by the rules of distribution of free software. You can use, | ||
modify and/ or redistribute the software under the terms of the CeCILL | ||
license as circulated by CEA, CNRS and INRIA at the following URL | ||
"http://www.cecill.info". | ||
As a counterpart to the access to the source code and rights to copy, | ||
modify and redistribute granted by the license, users are provided only | ||
with a limited warranty and the software's author, the holder of the | ||
economic rights, and the successive licensors have only limited | ||
liability. | ||
In this respect, the user's attention is drawn to the risks associated | ||
with loading, using, modifying and/or developing or reproducing the | ||
software by the user in light of its specific status of free software, | ||
that may mean that it is complicated to manipulate, and that also | ||
therefore means that it is reserved for developers and experienced | ||
professionals having in-depth computer knowledge. Users are therefore | ||
encouraged to load and test the software's suitability as regards their | ||
requirements in conditions enabling the security of their systems and/or | ||
data to be ensured and, more generally, to use and operate it in the | ||
same conditions as regards security. | ||
The fact that you are presently reading this means that you have had | ||
knowledge of the CeCILL license and that you accept its terms. | ||
*/ | ||
|
||
function loadXMLDoc(fname) { | ||
var xmlDoc; | ||
//code for safari | ||
if (/Safari/.test(navigator.userAgent)) { | ||
var xmlhttp = new XMLHttpRequest(); | ||
xmlhttp.overrideMimeType('text/xml'); | ||
xmlhttp.open('GET', fname, false); | ||
xmlhttp.send(null); | ||
if (xmlhttp.readyState == 4) { | ||
xmlDoc = xmlhttp.responseXML; | ||
} | ||
} else { | ||
// code for IE | ||
if (window.ActiveXObject) { | ||
xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); | ||
} | ||
// code for Mozilla, Firefox, Opera, etc. | ||
else if (document.implementation && document.implementation.createDocument) { | ||
xmlDoc = document.implementation.createDocument("","",null); | ||
} else { | ||
alert('Your browser cannot handle this script'); | ||
} | ||
xmlDoc.async = false; | ||
xmlDoc.load(fname); | ||
} | ||
return xmlDoc; | ||
} | ||
|
||
function loadFile(fname) { | ||
var xmlhttp = null; | ||
if (window.XMLHttpRequest) {// code for Firefox, Opera, IE7, etc. | ||
xmlhttp = new XMLHttpRequest(); | ||
} else if (window.ActiveXObject) {// code for IE6, IE5 | ||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); | ||
} | ||
if (xmlhttp != null) { | ||
xmlhttp.open("GET",fname,false); | ||
xmlhttp.send(null); | ||
if (xmlhttp.readyState == 4) { | ||
return xmlhttp.responseText; | ||
} | ||
} else { | ||
alert("Your browser does not support XMLHTTP."); | ||
} | ||
} | ||
|
||
function applyXslt(xml,xsl) { | ||
var xsl = loadXMLDoc(xsl); | ||
// code for IE | ||
if (window.ActiveXObject) { | ||
var ex = xml.transformNode(xsl); | ||
return ex; | ||
} | ||
// code for Mozilla, Firefox, Opera, etc. | ||
else if (document.implementation && document.implementation.createDocument) { | ||
var xsltProcessor = new XSLTProcessor(); | ||
xsltProcessor.importStylesheet(xsl); | ||
var resultDocument = xsltProcessor.transformToFragment(xml,document); | ||
return resultDocument; | ||
} | ||
} | ||
|
||
function applyXsltOnText(xml,xsl) { | ||
var xml = createDocumentFromText(xml); | ||
var result = applyXslt(xml,xsl); | ||
return innerXML(result); | ||
} |
Oops, something went wrong.