Re: [xsl] xsltproc [Error Log]

Subject: Re: [xsl] xsltproc [Error Log]
From: Liam R E Quin <liam@xxxxxx>
Date: Mon, 27 Dec 2010 13:26:30 -0500
On Mon, 2010-12-27 at 13:49 +0530, pankaj.c@xxxxxxxxxxxxxxxxxx wrote:
> Thanks Hermann/Andriy. 
> 2>error.log
> does the trick though I was not able to find any document for this.
> As always this list is awesome!!!!!!!!!!!

It applies to all command-line programs on Unix and Unix-like systems;
it's documented in the "man" page for the shell you are using; that
documentation is, however, written for programmers.

A couple of notes below on XML and command-lines, but first I'll
note that if you check your XML using an XML editor such as xxe or
oxygen, the GUI will take you right to the error.

On shells and terminals... (the shell is the program that prints the
prompt and runs commands; the terminal is the program that draws the
box on the screen)

Find out which shell it is with
echo $0
(ignore any leading "-"in the output)
and then you can search for a tutorial, e.g. bash tutorial or
tcsh tutorial, on the Web, or, for reference, try,
man bash
man tcsh
or whatever shell it turns out to be.

Simple shell scripts can be very useful as a way of documenting
process. A slightly more advanced way is to use the "make"
utility.  For example, you might have a script (a former
colleague, Kate Hamilton, always used to call the script "runme")
like this:

#! /bin/sh

# clean up first
rm -rf tmp out
mkdir out tmp
xsltproc add-ids.xsl input.xml |
    xsltproc split-into-files.xsl -

Now when you go to the directory you can easily remember what to do :-)

An enhancement is to check each step succeeded before moving on to the
next one:

#! /bin/sh

# clean up first
rm -rf tmp out

mkdir out tmp || exit 1

xsltproc add-ids.xsl input.xml > tmp/with-ids.xml

xmllint --noout tmp/with-ids.xml || exit 1

xsltproc split-into-files.xsl tmp/with-ids.xml

# check the last output file is there:
xmllint --noout out/zanzibar.xml || exit 1

(I'm assuming that "split-into-files.xsl" will create
out/zanzibar.xml of course)

Checking gainst a schema (or even just a DTD) at each
stage is also a good idea.


Liam Quin - XML Activity Lead, W3C,
Pictures from old books:

Current Thread