Just because they don’t support it…

According to the Xalan-j homepage, Xalan-J 1 is no longer supported. Unfortunately, I’m still using it, at least for the time being. These two realities colided a couple days ago when I ran into a problem with the following (filenames have been changed to protect the innocent):

java org.apache.xalan.xslt.Process -IN /path/datafile.xml -XSL /path/template.xslt -OUT /path/output.xml -PARAM basecurrencyiso 'EUR'

Despite the deceptive simplicity of the above, the output indicated a problem with the parameter value. Adding a element to the key template proved the point:

$ISO=EUR, $basecurrencyiso=
$ISO=CHF, $basecurrencyiso=
$ISO=DKK, $basecurrencyiso=
$ISO=EUR, $basecurrencyiso=

My parameter value was not making it into the process. Making the ‘no longer supported’ issue even more fun is the fact that Xalan-j 2 no longer requires the single quotes around string values. I tried with single quotes, without; I googled and groups.googled; I kept coming up dry.

Of course, those of you in the audience whose Unix skills are better than mine have already seen the issue… the shell was handling the single-quotes. The answer was stunningly simple:

java org.apache.xalan.xslt.Process -IN /path/datafile.xml -XSL /path/template.xslt -OUT /path/output.xml -PARAM basecurrencyiso "'EUR'"

The funny thing is, I never saw any example that showed the extra double quotes. An hour wasted, but not a true waste… I’ll bet that in the future I’ll be more quote-savvy in when working in Unix. And now I’ve documented it, so at least for a brief moment, Xalan-j 1 is once again supported… just not by Apache.

Both comments and pings are currently closed.

Comments are closed.