Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

XPATH Processor in java code  RSS feed

Sharang Thorat
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have an xml which i want to sort on certain elements
as specified by user GUI.
i intend to follow following steps

1. convert xml to another xml using XPATH processor
here sorting crieterion from user will be applied.
2. apply xslt on that xml and display

i could achive the step 2 in my code

File xmlfile = new File(file_path.concat("\\temp.xml"));
File stylesheet = new File(file_path.concat("\\rsdstylesheet.xsl"));

FileInputStream in = new FileInputStream(xmlfile);
FileInputStream xslfile = new FileInputStream(stylesheet);

XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
//StylesheetRoot parsedStyleSheet = null;

//parsedStyleSheet = processor.processStylesheet( new XSLTInputSource( xslfile ) );
processor.process(new XSLTInputSource(in),new XSLTInputSource(xslfile),new XSLTResultTarget(out));
}catch (Exception e)

but how to cheive step one. How to apply the user selected crieterion for sorting on the xml and using XPath convert it
to anohter xml. i know how to do it on command line
using org.apache.xalan.xpath.Process class but is there any implementation for that class to call it through the programme
like XSLTProcessor class.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!