1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| public static void returnResult(String product_id,PrintWriter out ){
File resultFile = new File(path+"resultText.xml");
Document resultDoc = getDocument(resultFile, out);
Element resultText = resultDoc.getRootElement();
Element productIdHere = resultText.getChild("productIdHere");
productIdHere.addContent(product_id);
// construction de l'arbre en memoire
File includeFile = new File(path+"topinclude.xsl");
Document includeDoc = getDocument(includeFile, out);
Element styleSheetRoot = includeDoc.getRootElement(); // recuperation de l'element racine
List templates = styleSheetRoot.getChildren();
for (int i=0; i < templates.size(); i++) {
Element thisTemplate = (Element)templates.get(i);
String thisMatch = thisTemplate.getAttributeValue("match");
if (thisMatch.equals("/")) {
Element htmlElement = thisTemplate.getChild("html");
Element bodyElement = htmlElement.getChild("body");
// creation d'un espace de nommage
Namespace xslns = Namespace.getNamespace("xsl","http://www.w3.org/1999/XSL/Transform");
List allContent = bodyElement.getChildren("apply-templates", xslns);
allContent.set(0, resultText); //ligne 71=> ERREUR
break;
}
}
... |
Partager