* This file is part of XEMELIOS.
*
* XEMELIOS is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
+ * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* XEMELIOS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
+ * You should have received a copy of the GNU Lesser General Public License
* along with XEMELIOS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import fr.gouv.finances.dgfip.utils.NavigationContext;
import fr.gouv.finances.dgfip.utils.Pair;
+import fr.gouv.finances.dgfip.utils.Xslt;
import fr.gouv.finances.dgfip.utils.xml.FactoryProvider;
import fr.gouv.finances.dgfip.utils.xml.transform.CustomURIResolver;
import fr.gouv.finances.dgfip.xemelios.auth.XemeliosUser;
DocumentModel dm = Loader.getDocumentsInfos(null).getDocumentById(ctx.getDocId());
EtatModel em = dm.getEtatById(ctx.getEtatId());
ElementModel element = em.getElementById(ctx.getElementId());
- File xslFile = null;
- xslFile = new File(new File(new File(System.getProperty("user.home")),"xemelios/documents-def-ovrrd"),element.getXslt());
- if(!xslFile.exists()) xslFile = new File(em.getParent().getBaseDirectory(),element.getXslt());
-
- FileInputStream fis = new FileInputStream(xslFile);
+
String docId = null;
if(ctx.getPath()==null) {
ArrayList<String> documents = impl.getDocumentListFromSpecialKeys(element,ctx.getCollectivite(),ctx.getBudget(),ctx.getSp1(),ctx.getSp2(),ctx.getSp3(),user);
}
Document doc = impl.getDocumentAsDom(em,new Pair(ctx.getCollectivite(),null),new Pair(ctx.getBudget(),null),docId , user);
+ File xslFile = Xslt.getFile(dm, em, element, doc);
+
TransformerFactory tFactory = FactoryProvider.getTransformerFactory();
tFactory.setURIResolver(new CustomURIResolver(tFactory.getURIResolver(), xslFile.getParentFile().toURI().toURL().toExternalForm()));
Transformer t = tFactory.newTransformer(new StreamSource(xslFile));