Hello, we're using the XSLTC compiler in order to transform an xsl document into a translet and then run it. We want to pass some parameters (as variables) ,so we define them in the xsl file as <xsl:variable name="style15" > select="style"/> . We also tried including a parameter as <xsl:param name="style15" select="'defaultvalue'" /> The whole program finally produces an html, which contains an 'empty' frame (columns and rows are formed, but no text is displayed). the code I'm using for this is as shown below (following the examples provided in the documentation). I must say that I've already received an answer, but what I saw was exactly as the code as I have here, so I also enclose the xml file and xsl file I've been using. (there are more variables that have to be passed as parameters in the xsl, I just ignore them here for simplicity). Could anybody point out to me what goes wrong?
try { String key = "javax.xml.transform.TransformerFactory"; String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"; Properties props = System.getProperties(); props.put(key, value); System.setProperties(props); String xslInURI = "PersonalizedNews.xsl"; String xmlInURI = "newsStaticFileStef.xml" ; String htmlOutURI = "output.html"; TransformerFactory tFactory = TransformerFactory.newInstance(); Templates templates = tFactory.newTemplates(new StreamSource(xslInURI)); // Transformer transformer = tFactory.newTransformer(new StreamSource(xslInURI)); Transformer transformer = templates.newTransformer(); transformer.setParameter("style15","VALUE"); // Perform the transformation from a StreamSource to a StreamResult; transformer.transform(new StreamSource(xmlInURI),new StreamResult( new FileOutputStream(htmlOutURI))); } catch (Exception e) { e.printStackTrace(); } One more note : I tried to do the same without using TrAX (I used sample code that defined a compileStyleSheet() , a getDOM() and a doTransform() function) and this produced the correct document, with text and everything, but again could not pass variables _______________________________________________________________________ Stefanos Pichas Ε - Finance Department Intarget S.A. Rizariou 10 (Olympic Stadium Bridge) 15233 Chalandri, Greece Tel: +30 1 68.74.300 Fax: +30 1 68.74.332 E-mail: <mailto:[EMAIL PROTECTED]> or: <mailto:[EMAIL PROTECTED]> URL: <http://www.intarget.com/> _______________________________________________________________________ ΗΛΕΚΤΡΟΝΙΚΑ ΚΕΙΜΕΝΑ ΕΙΝΑΙ ΔΕΣΜΕΥΤΙΚΑ ΓΙΑ ΤΗΝ INTARGET ΜΟΝΟ ΣΕ ΠΕΡΙΠΤΩΣΗ ΠΟΥ ΣΥΝΟΔΕΥΟΝΤΑΙ ΑΠΟ ΑΡΜΟΔΙΩΣ ΥΠΟΓΕΓΡΑΜΜΕΝΟ ΕΓΓΡΑΦΟ. ALL TEXTS INTENDED TO BIND INTARGET WILL BE FOLLOWED BY A DULY SIGNED HARD COPY OF THE SAME CONTENT. _____________________________________________________________________ <<PersonalizedNews.xsl>> <<newsStaticFilestef.xml>>
PersonalizedNews.xsl
Description: Binary data
newsStaticFilestef.xml
Description: Binary data