andrewjwelch.com

Kernow running a multithread directory transform
Kernow 1.6 running a multithread directory transform

KernowKernow 1.8

Kernow makes it faster and easier to repeatedly run XSLT, XQuery and XML Schema.


Contact details
Kernow Saxon
Kernow is available in English, French and German
Kernow is available in English, French and German
What is Kernow?
It uses compiled stylesheets, multiple threads and caching resolvers to make the transforms run efficiently, and comboboxes that remember between runs to save your fingers having to retype paths. Kernow is runnable from Ant allowing it to slot into your build process, and its a high level API for Saxon making it very easy to run transforms from your own Java applications.
Kernow is written by Andrew Welch using Java 1.7.

Special thanks to:
Florent Georges
- Additional coding
- French translation

Michael Müller-Hillebrand
- German translation
Downloading And Running Kernow
Kernow is hosted on SourceForge which can be difficult to navigate around the first time you use it. Clicking the link above opens the "Project page" for Kernow, click the green "Download Kernow" button on that page, then click "Download" next to the latest version of Kernow, and finally click "kernow.zip". Once downloaded and unzipped, for Windows users just double-click Kernow.exe or use the run.bat file. For non-Windows users, make sure all the Jar files in the lib folder are on the classpath, and then use the entry point: net.sf.kernow.GUI
Alternatively you can run Kernow now using Java Web Start. This will install Kernow on your machine and add icons to your desktop and start menu. It will take a long time the first time you run it as the program downloads in the background, however from then on it will run from your machine and automatically update itself when I release new versions, which is cool.
How long does the trial last?
The trial version of Kernow allows you to click the Run button 100 times, after that you can purchase a licence to unlock it and carry on using it. The "sandboxes" remain available to use all the time (even when the more commercial features are locked)
What are Single File, Standalone and Directory transforms?
Single File transforms consist of an input XML file, an XSLT file, and optionally an output file. If no output file is specified all output is sent to Kernow's output window.
Standalone transforms don't have an input XML file, they are purely an XSLT 2.0 file with a specified initial template to start the processing at. Standlone transforms either don't need input, or manage the input within the transform (through doc(), document(), collection(), unparsed-text() etc). Again an optional an output file can be specified or all output is display in the output window.
Directory transforms consist of an input directory, an XSLT file and an output directory. Each input is transformed to an output file.
What are the 'sandboxes'?
The sandboxes are areas where you can play with XSLT, XQuery and XML Schema. They are ideal for when you want to quickly try something out. They provide xml-based syntax highlighting and syntax checking as-you-type, and some code samples are available from the right-click menu.
Kernow Options - enable the resolvers for best performance
Kernow Options - enable the resolvers for best performance
Caching Entity and URI Resolvers, and the local cache
Directory transforms are really helped by caching entity resolvers - these store items that would otherwise be fetched for each transform of each input file. Kernow contains a caching entity resolver (useful when the XML contains DTD references), a caching URI resolver (useful for files referenced in the XSLT) and a "caching entity resolver for the Collection() function", which is an entity resolver used specificly by the collection() function. Each of these can be disabled in the options, but its unlikely you would ever want to.
The local cache facility allows you specify a place where the resolvers should look first. Typically a resolver will fetch a resource off the net and then store it in memory - to avoid that inital fetch store a copy of the resouce locally and then point Kernow at that.
If you don't want to see "The resolver has cached..." messages, then check the "suppress caching messages" checkbox.
LexEV
Kernow now integrates LexEv, which can be enabled in Options -> Kernow Options -> LexEv tab. LexEv captures the lexical events that are typically lost during parsing. For more information, the LexEv page.
Set the input files that should be processed and choose the output suffix
Set the input files that should be processed and choose the output suffix
Setting input and output suffixes
Under the Options -> General tab you can set the output suffix used for directory transforms, and the allowed input suffixes. When you run a directory transform you supply input and output directories, and the XSLT file. Kernow will build a file list of all files in the input directory with suffixes that match one of the allowed input suffixes, optionally recursing from there down. This allows you to transform say, all .htm files (HTML files that are really well-formed XML) but ignore other files like .css, .gif etc.
Kernow transforms each input file to a primary output file of the same name, but with a suffix dependant on the following rules:
  • If a suffix is supplied (and enabled) in the options that suffix is used. Useful if you want to have a proprietary extension.
  • If a specific suffix is not supplied in the options, Kernow will use the following mappings based on the output method specified in the transform: "html" and "xhtml" become ".html", "text" becomes "txt" and anything else becomes ".xml".
  • If no suffix is supplied in the options and no output method is used, it defaults to ".xml"
Set how many threads Kernow should use
Set how many threads Kernow should use
Using multiple threads for directory transforms
Under the Options -> Multithreading tab you can set the number of threads to use for directory transforms. By default this is set to 1, which is effectively the same as running a single threaded application. If you are running Kernow on a multi-core or multi-processor system and have sufficient memory to run multiple threads, *and* the number and type of transforms involved outweighs the cost of creating the threads then you will benefit from using multiple threads. In other cases you may find increasing this number has a negative effect because the bottleneck is disk I/O, and using mutliple threads adds the extra overhead of thread creation and management.
It's best to experiment to find the right value that suits your system and the type of transform you're running.
The performance testing tab
The performance testing tab
Performance Testing
Under the Options -> Performance Testing tab you can tell Kernow to repeatedly run Single File or Standalone transforms and then display the average time for those runs. This is useful when you want to test the performance of a transform, as the first few runs can produce very different times as the JVM "warms up". When working out the average time across the runs, Kernow will ignore the first n runs specified here.
The defaults of 5 and 2 are probably ok for most needs - the first 2 times will be ignored with the average taken from the remaining 3.
You can set most of Saxon's command line options here
You can set most of Saxon's command line options here
The Saxon Options dialog
The XQuery Sandbox with as-you-type syntax checking
The XQuery Sandbox with as-you-type syntax checking
Running XQuery from Kernow
XQuery support is limited in Kernow - you can run an individual .xqy or .xquery file in the Standalone tab (it will detect its an XQuery file from the extension) or you can just play in the XQuery Sandbox tab. This has basic syntax highlighting and performs syntax checking as you type.
Performing directory validation
Kernow can be used to validate directories of XML with W3C XML Schemas, using either Xerces, Saxon-SA or any JAXP schema processor. Select the directory to validate, select schema (click "check schema" to ensure the schema compiles) and then click run.
The Kernow API
Since 1.5 Kernow has an API which hides the complexities of running transforms. If you want to run a directory transform with a compiled stylesheet, caching resolvers and default options, you would use:
Kernow kernow = new Kernow();
kernow.runDirectoryTransform(inputDir, XSLT, outputDir, params);
See the javadoc for more information.
Running Kernow from Ant
Since 1.5 Kernow can be run from Ant. If you run a sequence of transforms then its useful to run them using Ant, rather than select the files involved from the comboboxes each time. Kernow comes with a sample buildfile which can be used as a boilerplate for chaining the transforms. If you want to run this process, or just an individual target in the process, then you can use the "Batch" tab in Kernow.
The Batch Tab
The batch tab is an experimental "Ant Runner" designed to make it easy to execute Ant targets in a buildfile. It will run any Ant buildfile, but its intended purpose is to selectively run targets in a buildfile that is normally used to run Kernow as part of a batch process.
Memory issues - increasing the amount of memory available to Kernow
To increase the amount of memory available to Kernow, increase the "-Xmx256m" value in the Run.Bat file (for example -Xmx1024m to give the JVM 1GB).
Support and features requests


Back to top

Valid XHTML 1.0 Transitional