Re: Aw: Re: XSL transformation with Ant: sorting a list

<[email protected]>
Newsgroups gmane.comp.jakarta.ant.user
Message-ID <20160307135457.HLART.83555.root@cdptpa-web26>
Al,

It wasn't apparent to me why there'd be a difference...

If you are using the same JVM and simply executing the XSL differently, I don't see why not...

I mean once you kick of the XSL I can't imagine there is something different in running from Ant vs your Java app.  I spent a number of years on an ESB team doing mostly XSLTs (and XSDs) - I always used Ant to test even though we ran the XSLTs in our environments from Java.  I never noticed any difference that way at all.


---- Al Le <[email protected]> wrote: 
> 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 java.io.File;
> import java.io.StringWriter;
> 
> import javax.xml.transform.Result;
> import javax.xml.transform.Source;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
> 
> 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);
> 
> 		stringWriter.flush();
> 		String xmlResult = stringWriter.toString();
> 
> 		System.out.println(xmlResult);
> 	}
> 
> }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.