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 8850313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:52:23+00:00 2026-06-14T12:52:23+00:00

My XSL-FO transformation will not work with XML specified below. It seems those xmlns

  • 0

My XSL-FO transformation will not work with XML specified below. It seems those xmlns and schemaLocation are bothering the transformation.

<book
xmlns="http://www.example.org/book"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.org/book book.xsd">

    <title>Something</title>
</book>

But if I rewrite my XML like below, the transformation runs smoothly and all my XPaths in the XSL are running good.

<book>
    <title>Something</title>
</book>

My question is: Is there some way to ignore those few lines of code which determine the schema location etc. ???

Thank you in advance!

Java class:

public static void generirajPDF() {
    try {

        // Setup directories
        File baseDir = new File(".");
        File outDir = new File(baseDir, "pdf");
        outDir.mkdirs();

        // Setup input and output files
        File xmlfile = new File(baseDir, "WebContent/AvtoSolaZ2.xml");
        File xsltfile = new File(baseDir, "WebContent/AvtoSolaZaposleniXSL.xsl");
        File pdffile = new File(outDir, "Test.pdf");

        // configure fopFactory as desired
        FopFactory fopFactory = FopFactory.newInstance();

        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        // configure foUserAgent as desired

        // Setup output
        OutputStream out = new java.io.FileOutputStream(pdffile);
        out = new java.io.BufferedOutputStream(out);

        try {
            // Construct fop with desired output format
            Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);

            // Setup XSLT
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer = factory
                    .newTransformer(new StreamSource(xsltfile));

            // Set the value of a <param> in the stylesheet
            transformer.setParameter("versionParam", "2.0");

            // Setup input for XSLT transformation
            Source src = new StreamSource(xmlfile);

            // Resulting SAX events (the generated FO) must be piped through
            // to FOP
            Result res = new SAXResult(fop.getDefaultHandler());

            // Start XSLT transformation and FOP processing
            transformer.transform(src, res);

        } finally {
            out.close();
        }

        if (pdffile.toString().endsWith(".pdf"))
            Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + pdffile);
        else {
            Desktop desktop = Desktop.getDesktop();
            desktop.open(pdffile);
        }

        System.out.println("Konec");

    } catch (Exception e) {
        e.printStackTrace(System.err);
        System.exit(-1);
    }
}
  • 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-14T12:52:24+00:00Added an answer on June 14, 2026 at 12:52 pm

    If you use an XSLT 2.0 processor to run your XSLT then set

    <xsl:stylesheet
      xmlns:xsl="http://www.w3.org/1999/XSL/Transformation"
      xpath-default-namespace="http://www.example.org/book"
      version="2.0">
    

    on the root element of the stylesheet and you don’t need to change the match patterns and XPath expressions in the code.

    If you use an XSLT 1.0 processor you need to rewrite your code to cater for the namespace by doing e.g.

    <xsl:stylesheet
      xmlns:xsl="http://www.w3.org/1999/XSL/Transformation"
      xmlns:df="http://www.example.org/book"
      exclude-result-prefixes="df"
      version="1.0">
    
    <xsl:template match="df:book">
      <xsl:value-of select="df:title"/>
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Xsl transformation to display an Xml data as Html. <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform
i am not being able to render a bulleted list through xml/xsl transformation. I
My xsl file: <?xml version=1.0 encoding=UTF-8?> <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform xmlns:go=http://www.google.com exclude-result-prefixes=go> <xsl:include href=SomeLibrary.xsl/> <xsl:template
Given the following XML and XSL transformation, I'd expect two <node/> elements in the
I am using an XSL transformation on an xml file to create an xml
I have three files, an xml template, xsl transformation file, and an xsd data
I need to make XSL transformation of my xml-file on windows phone 7 platform.
Im trying to transform an XML document into XHTML using XSL transformation and was
I am using Transformer to perform XSL transformation from XML to XHTML: import javax.xml.transform.Transformer;
I have a complicated XML and I am trying to write a XSL transformation

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.