2006-07-16

How to use Xalan in XMLSpy 2004

Today I needed to tweak (i.e. maintain) an XML Stylesheet (XSL-T) that was written by some team mate. Since the stylesheet runs inside a Java and XML application, it uses Xalan and some Java function-calls, like so: <xsl:value-of xmlns:java="http://xml.apache.org/xslt/java" select="substring(java:toUpperCase(java:java.lang.String.new(string(text()))),1,50)"/>

I wanted to make the changes with XMLSpy, since that would allow me to have the test-instance, the source- and target-schema and the stylesheet all open at once and be able to do transformation and validation of the result with a keypress – which is a good thing, when you're incrementally changing and checking. (Yes, I would find my way round on the command-line, but for some tasks IDEs are just nicer, and this I consider one of them.)

The problem now is that XMLSpy 2004 does have an internal XSL-T transformer, but this doesn't know about the Java parts. Luckily, XMLSpy can be configured to use an external transformer, the option is under Tools > Options : XSL, and looks like this:

XSL-T Xalan in XMLSpy konfigurieren

As you perhaps already guessed from the screenshot, we need to make Xalan callable on the command-line. To achieve this, I wrote a small .cmd-File that hides the Java setup from the world and calls the appropriate class with the correct parameters. Here, Xalan is quite supportive, as it provides a class to call from the command-line. Thus, we only need to wrap up the libraries and be done! Here's the xalan.cmd:

@echo off
setlocal
set XALAN_LIBS=D:\jars\xalan-j_2_7_0
java -cp %XALAN_LIBS%\serializer.jar;%XALAN_LIBS%\xalan.jar;%XALAN_LIBS%\xercesimpl.jar;%XALAN_LIBS%\xml-apis.jar org.apache.xalan.xslt.Process -IN %1 -OUT %2 -XSL %3
endlocal

I sorted the input parameters in the order XMLSpy expects them, so in XMLSpy we can go straight forward with %1 %2 %3.

And with this you can use Xalan as a transformation engine in XMLSpy 2004. Newer versions of XMLSpy, I hear, come with Xalan preconfigured, but in case you're still at 2004 this will do.

2006-07-02

macupdate.de, im Ansatz gescheitert?

Coming soon to a Mac near you 2003

Ich weiß nicht, das ist sooo 2003.

Mein Fehler, na klar!

Kicker: Sie haben einen Fehler verursacht

Das ist ein Armutszeugnis des Kicker-Webauftritts! Ich soll bei denen einen Fehler verursacht haben? Ich kenne ein oder zwei Programmierer, aus deren Sicht sind die "unsinnigen" Eingaben der User für Fehler verantwortlich, und nicht etwa sie selbst, die mit sowas nach ein paar Jahren Programmiererfahrung rechnen können. Lehre daraus: Auch mal einen unbeteiligten Dritten über die Fehlermeldungen des Systems schauen lassen.

Was ich Schlimmes gemacht habe? Auf Werbung in Google Mail geklickt, diesen Link nämlich. Und dann kommt die o.a. Fehlermeldung von dieser Seite.

Nachtrag: Was kostet eigentlich solche Werbung bei Google Mail? Google Mail: Werbelink für Kicker
Die Links scheinen nämlich alle obigen Fehler hervorzurufen …