Hi everyone, please check out our new discussion forum located in our GitHub site: https://github.com/nextgenhealthcare/connect/discussions. Let us know your feedback as we try out this new part of GitHub! Don't worry, the content in these forums won't be going away and will at a minimum be preserved for historical reference.
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
processor.process(new XSLTInputSource(msg), new XSLTInputSource("[url]http://localhost/mirth.xsl"«»[/url]), new XSLTResultTarget(bos));
channelMap.put(toXSL,bos)
from the mirth valiation I get the error :
Error on line 1: mising ; before statement (850f3251-df69-4a94-b8a0-eaf51bc97519#1)
After that i change the code to :
Code:
processor = XSLTProcessorFactory.getProcessor();
bos = new ByteArrayOutputStream();
processor.process(new XSLTInputSource(msg), new XSLTInputSource("[url]http://localhost/mirth.xsl"«»[/url]), new XSLTResultTarget(bos));
channelMap.put(toXSL,bos)
And i get the error
ReferenceError: "XSLTProcessorFactory" is not defined.
I emailed you this code snippet but I will post here in case someone else has the same problem. Here is the code I used to do the xslt transformation:
importPackage(Packages.javax.xml.transform);
importPackage(Packages.javax.xml.transform.stream) ;
var tFactory = TransformerFactory.newInstance();
var xslSource = new StreamSource("c:\\ORU-R01.xsl");
var transformer = tFactory.newTransformer( xslSource );
var bos = new java.io.ByteArrayOutputStream();
var sbis = new java.io.StringBufferInputStream(msg);
transformer.transform( new StreamSource(sbis),new StreamResult( bos ));
msg = bos.toString();
I am brand new to xslt and am wanting to do something like this but am finding resources to be inadequate. Can someone point me to a good tutorial on xslt that is focused on xml to xml transformation?
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:«»stylesheet version="1.0" xmlns:«»xsl="[url]http://www.w3.org/1999/XSL/Transform">[/url]
<xsl:template match="/">
<xsl:for-each select="sample">
**change name of sample to aloquot**
</xsl:for-each>
</xsl:template>
</xsl:«»stylesheet>
the above example was borrowed from w3c schools
Post edited by: fmason, at: 12/16/2008 14:42
Fieran Mason-Blakley
Standards Researcher
Genologics Life Sciences
So this is essentially a best practices question but includes some nuts and bolts details
I make a REST call and get a response - I want to transform that response - it seems to me that the most appropriate place to do that is in at postprocessor step. In Mirth however, as of yet, there doesn't appear to be a transform step there. I can do it manually like I was about to in 1.7.1, but it seems like I should be able to take advantage of the built in xslt support - that would be a much cleaner way to do this.
I am also still struggling with the purpose and use of a number of the provided functions
These two for example seem like they would do a lot of what I am trying to accomplish. I don't know however, how to get a reference to my connector. There doesn't appear to be an id like there is with the channels, do I just need to dig through the source code and figure that out or is there more documentations somewhere?
importPackage(Packages.javax.xml.transform);
importPackage(Packages.javax.xml.transform.stream);
java.lang.System.out.println('Channel B - Transformer - response:\n' + responseMap.get('myHTTPSender').getMessage());
var tFactory = TransformerFactory.newInstance();
var xslSource = new StreamSource("path to xsl"«»);
var transformer = tFactory.newTransformer( xslSource );
var bos = new java.io.ByteArrayOutputStream();
var sbis = new java.io.StringBufferInputStream(responseMap.get('myHTTPSender').getMessage());
transformer.transform( new StreamSource(sbis),new StreamResult( bos ));
java.lang.System.out.println('Channel B - Transformer - transformed response:\n' + bos.toString());
responseMap.get('myHTTPSender').setMessage( bos.toString() );
Fieran Mason-Blakley
Standards Researcher
Genologics Life Sciences
importPackage(Packages.javax.xml.transform);
importPackage(Packages.javax.xml.transform.stream) ;
var tFactory = TransformerFactory.newInstance();
var xslSource = new StreamSource("c:\\ORU-R01.xsl");
var transformer = tFactory.newTransformer( xslSource );
var bos = new java.io.ByteArrayOutputStream();
var sbis = new java.io.StringBufferInputStream(msg);
transformer.transform( new StreamSource(sbis),new StreamResult( bos ));
msg = bos.toString();
Hello
I need to get output file by adding xsl style on my given input xml file
What is the steps which I have to follow
I have input xml file and XLS file
When I manually combine these two with "<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>" these kind of include it will work
What Mirth can do for achieving this
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, personalize advertising, and to analyze site activity. We may share certain information about our users with our advertising and analytics partners. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment