Transform Multiple xml input source as stream to one xslt using saxon - saxon

I am new to saxon and xslt, we have business in which feeder delivere more than one xml files, xslt generated from altov) create one output xml files , we have selected saxon as transformer.
so far i am able to transform single xml file
do any body have example where xslt takes more than one xmls as input stream, transform using saxon.
Thanks & regards,
Kumar

You haven't told us enough about the requirements, but there are several techniques to be aware of:
You can pass additional documents as stylesheet parameters declared using xsl:param
You can read a document (given its URI) using the doc() or document() functions
You can read a whole collection of documents (e.g. the contents of a directory) using the collection() function

Related

Adtf dat files - streams and structure types

ADTF dat file contains streams of data. In the .dat file there is only a stream name. To find the structure of the stream one has to go through DDL .description file.
Sometimes the .description files are incomplete or are missing link from stream name to corresponding structure.
Is there some additional information about structure name hidden in the .dat file itself? (Or my understanding is completely wrong?)
You must differ between ADTF 2.x and ADTF 3.x and their (adtf)dat file structure.
ADTF 2.x:
You are right, you can only interpret data with ddl. The stream must point to a structure described in Media Description.
Sometimes the .description files are incomplete or are missing link
from stream name to corresponding structure.
You can avoid this by enable the Option Create Media Description in Harddisk Recorder. Then a *.dat.description will be stored next to the same-titled *.dat file, which contains the correct stream and structure reference, because it was available during recording.
Is there some additional information about structure name hidden in the .dat file itself?
No, it is only the stream name. So you need to know the data structure behind to interpret. If you have the header (c-struct), you can also convert to ddl and refer to that.
ADTF 3.x:
To avoid these problems for not available or incorrect description files, the DDL is now stored in the *.adtfdat file in ADTF 3.x

Add new values to XML dynamically

I have an XML file in my app resources folder. I am trying to update that file with new dictionaries dynamically. In other words I am trying to edit an existing XML file to add new keys and values to it.
First of all can we edit a static XML file and add new dictionary with keys and values to it. What is the best way to do this.
In general, you can read an XML file into a document object (choose your language), use methods to modify it (add your new dictionary), and (re-)write it back out to either the original XML file, or a new one.
That's straightforward ... just roll up the ol' sleeves and code it up.
The real problem comes in with formatting in the XML file before and after said additions.
If you are going to 'unix diff' the XML file before and after, then order is important. Some standard XML processors do better with order than others.
If the order changes behind the scenes, and is gratuitously propagated into your output file, you lose standard diffing advantages, such as some gui differs, and some scm diffs (svn, cvs, etc.).
For example, browse to:
Order of XML attributes after DOM processing
They discuss that DOM loses order where SAX does not.
You can also write a custom XML 'diff'er (there may be such off-the-shelf ... for example check out 'http://diffxml.sourceforge.net/') that compares 2 XML documents tag-by-tag, attribute-by-attribute, etc.
Perhaps some standard XML-related tool such as XSLT will allow you to keep the formatting constant without changing tag or attribute order. You'd have to research that.
BTW, a related problem is the config (.ini) file problem ... many common processors flippantly announce that the write-order may not agree with the read-order.

Iterating over DOM Objects being returned by Java methods in XSLT

We have been using Xalan for XSL transformations for quite a while and recently moved over to Saxon for XSL transformation Version 1.0 (Backward Compatibility mode). I am calling a Java Method from XSL which returns a document object and iterating over the document object for further transformations . The transformations are proper in case of Xalan whereas I am unable to achieve the same in case of Saxon. Please let me know how to achieve the same while working with Saxon XSLT parser.
You have raised the same question in a direct support request to Saxonica and we are trying to help you via that channel.

What are the alternatives to store a external XML file without the XSLT document function in XSLT2.0?

What are the alternatives to store a external XML file without the XSLT document function in XSLT2.0
The document functions exists since XSLT 1.0, but not to store a secondary XML document, but rather to load it.
With XPath and XSLT 2.0 for a single document you can also use the doc function to load the document e.g. <xsl:apply-templates select="doc('foo.xml')//bar"/>. And there is the collection function which often allows accessing a collection of files (e.g. those in a directory) but the exact syntax depends on the XSLT processor/XSLT implementation.

Comparing Docx files using OOXML

How can I read word-by-word (with styles) from a docx file. I want to compare two docx files word-by-word and based on the differences I have to write into another docx file (using c# and OOXML).
I have tried achieving this by using DocumentFormat.OpenXml.Extensions.dll, OpenXMLdiff.dll and ICSharpCode.SharpZipLib.dll but nothing is giving me the option to read word-by-word(ICSharpCode.SharpZipLib does give word-by-word but it will not give style associated with that word).
Any help on this will be very useful.
This MSDN article shows how to reliably retrieve the exact text of a document, paragraph by paragraph.
http://msdn.microsoft.com/en-us/library/ff686712.aspx
At the same time, you can determine the style for each paragraph. That is pretty easy. The following blog post shows how to retrieve the style and text for each paragraph:
http://blogs.msdn.com/b/ericwhite/archive/2009/02/16/finding-paragraphs-by-style-name-or-content-in-an-open-xml-word-processing-document.aspx
Comparing the two? It depends on your exact desired semantics. One approach would be to create an XML document that contains paragraphs and styles, then comparing the XML documents. The XML document might look something like this:
<Root>
<Para>
<Style>Normal</Style>
<Text>This is the text of the paragraph.</Text>
</Para>
<Para>
<Style>Heading1</Style>
<Text>Overview of the Process</Text>
</Para>
</Root>
The easiest way is to just unzip the DOCX file using your favorite ZIP library and then compare the text files with a file IO library.

Resources