Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-2385

hi need a great help please post me :)

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Resolved
    • Trivial
    • Resolution: Not A Bug
    • 2.7
    • None
    • Xalan
    • None
    • Unix
      Solaris

    Description

      Good morning
      i have 1 great problem whit stykesheet.
      I trasmormed 1 xsl in 1 class java whit xalan
      and now i need use this class in other my class for create 1 fop Document.
      Not found what class i need and what source i need use for this implementation.
      Any one write in this post a little code to example me?
      my code in this moment is this!!!
      ehre i modified my code for use a class and not a file?
      pls help not understend where is the point and class
      tanks

      File xmlfile = new File("webapps"req.getContextPath()+fileSeparator"data"+fileSeparator,xmlNames[0]);
      File xsltfile = new File("webapps"req.getContextPath()+fileSeparator"xslfo"+fileSeparator,xsltNames[0]);

      String baseUrl = "http://"req.getServerName()+req.getContextPath()+fileSeparator"xslfo";
      // setup canale uscita

      ByteArrayOutputStream outi = new ByteArrayOutputStream();

      try

      { // configurare fopFactory FopFactory fopFactory = FopFactory.newInstance(); DefaultConfigurationBuilder build = new DefaultConfigurationBuilder(); Configuration config = build.buildFromFile(new File("/usr/local/fop/conf/fopConfig.xml")); fopFactory.setUserConfig(config); // configurare foUserAgent FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); foUserAgent.setBaseURL(baseUrl); // carichiamo la fop Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, outi); // carichiamo il file di conversione xslt TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(new StreamSource(xsltfile)); // valori nello stylesheet transformer.setParameter("versionParam", "2.0"); // carichiamo i dati del file Source src = new StreamSource(xmlfile); // creiamo l'oggetto sax utilizzato per la conversione con i parametri definiti dal fop per acrobat Result res = new SAXResult(fop.getDefaultHandler()); // converto i dati transformer.transform(src, res); }

      Attachments

        Activity

          People

            Unassigned Unassigned
            mirko_bruzzi mirko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: