ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Al Le" <>
Subject Aw: Re: XSL transformation with Ant: sorting a list
Date Mon, 07 Mar 2016 12:56:55 GMT
Hello Scot,

thanks for a quick response!

> first you are killing yourself in the way you XSLT is 
> written
> [. . .]
> You are trying to do the work of the templating engine in your XSLT :)

Yes, I know this is a "procedural" way of doing things and maybe not the best. But the example
is just an example. The real script is much bigger and more complicated. I just tried to give
a simple case to reproduce the problem.

Do you also think that it should work (despite the fact that it's may be not the best way
to do it)?

The java program I used to verify the transformation is:

package my.test;


import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;

public class Transform {

	public static void main(String[] args) throws Exception {
		String inputFileName = "Q:\\MiscThings\\t\\a.xml";
		String xslFileName = "Q:\\MiscThings\\t\\trans.xsl";

		Source xmlSource = new StreamSource(new File(inputFileName));
		Source xslSource = new StreamSource(new File(xslFileName));

		StringWriter stringWriter = new StringWriter();
		Result transformationResult = new StreamResult(stringWriter);

		TransformerFactory transformerFactory = TransformerFactory.newInstance();
		Transformer transformer = transformerFactory.newTransformer(xslSource);
		transformer.transform(xmlSource, transformationResult);

		String xmlResult = stringWriter.toString();



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message