Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8596039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:34:58+00:00 2026-06-12T00:34:58+00:00

I wrote a xslt for xalan , that works fine with the xalan cli

  • 0

I wrote a xslt for xalan, that works fine with the xalan cli (org.apache.xalan.xslt.Process). The xslt uses the xalan extension redirect It does generate several xml files like expected.

Now I would like to do the transformation from a Java application. I looked at the org.apache.xalan.xslt.Process source code, it is a bit complicated (1,000 lines of if/then/else). I could not find documentation. I am looking at the minimal code to call the transform and potentially set the output directory.

I tried something like:

    final ByteArrayOutputStream out = new ByteArrayOutputStream();
    InputStream in = null;
    InputStream xsl = null;
    try {
        in = inputFileStream;
        xsl = url.openStream();
        final TransformerFactory tFactory = TransformerFactory
                .newInstance();
        final Transformer transformer = tFactory
                .newTransformer(new StreamSource(xsl));
        transformer.transform(new StreamSource(in), new StreamResult(out));
    } catch (Throwable t) {
        Activator.logErrorMessage(NLS.bind(
                Messages.Import_XSLT_TRANSFORMATION_FAILED, t.toString()));
    } finally {
        IOUtils.closeQuietly(xsl);
        IOUtils.closeQuietly(in);
        IOUtils.closeQuietly(out);
    }

It works fine for a simple xslt (i.e. without the redirect extension). If I use a xslt with the redirect extension I get the regular output <?xml version="1.0" encoding="UTF-8"?> but no other output files (like I got when using org.apache.xalan.xslt.Process).

What is the minimal call/API to use to transform using a xslt with redirect extension, and knowing where all the output files will end up ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:34:59+00:00Added an answer on June 12, 2026 at 12:34 am

    Actually the code was working fine. It is just that I was not providing a full path to the redirect:write file="" and so I missed the fact that the output files were actually written.

    I passed a parameter from the java to the xslt:

    final Transformer transformer = templates.newTransformer();
    transformer.setParameter("containerFullPath", containerFullPath);
    transformer.transform(new StreamSource(in), new StreamResult(out));
    

    And added the following line in the xslt:

    <xsl:param name="containerFullPath"/> <!-- at the root of the xslt -->
    ...
        <redirect:write  file="{$containerFullPath}/{$modelName}-{@name}.bpmn">
    ...
    

    Now, I can see the output files where they are supposed to be.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i wrote code in xslt to convert xml file to html file. that html
I just wrote an XSLT that did not work at first. I had to
I wrote this function that feeds into an XSLT tool for reporting. It's incredibly
I wrote a process explorer using C with GUI interface. I want to add
I wrote a PHP script that retrieves values from a MySQL Query. I used
I wrote a Flickr search engine that makes a call to either a public
Has this ever been done before? Is it possible to write an XSLT that
I'm trying to write a simple .xslt to process .xml files. But I've been
I'm working on a project that involves XSLT. And would like to use a
I'm trying to write an XSLT that organizes an HTML file into different section

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.