1

When I am trying to generate HTML from XML+XSLT in jdeveloper 10g using a java class I am getting following error

XML-22108: (Error) Invalid Source - URL format is incorrect.

XML-22000: (Fatal Error) Error while parsing XSL file (no protocol: headerMenu.xsl)

But when I am compiling the file with another jdk from command line it is working fine.

Following is my code snippet

 TransformerFactory tFactory = TransformerFactory.newInstance();

        Transformer transformer = 
            tFactory.newTransformer(new javax.xml.transform.stream.StreamSource(xslHeaderMenu)); //takes the xsl

             System.out.println("...xsl for header navigation menu block included...");

        transformer.transform(new javax.xml.transform.stream.StreamSource(xmlDataFile), 
                              new javax.xml.transform.stream.StreamResult(new FileOutputStream(htmlHeaderMenu))); //takes the xml and generates html for header menu

Please advice how can I generate inside jdeveloper

2
  • What is in xslHeaderMenu and xmlDataFile? Commented Jun 25, 2012 at 9:29
  • String xslHeaderMenu = "headerMenu.xsl"; String xslLeftMenu = "leftMenu.xsl"; Commented Jun 25, 2012 at 11:19

1 Answer 1

3

In the javadoc for StreamSource, the string method says that it 'Must be a String that conforms to the URI syntax', which you 'headerMenu.xsl' isn't.

I would try:

tFactory.newTransformer(
  new javax.xml.transform.stream.StreamSource(
    new File(xslHeaderMenu))); //takes the xsl

as File can take an abstract filename (also for the other streamsource)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.