Tag: Saxon9

  • after a couple of months using XPath and xmlstarlet I created my first lenghty XQuery script using Saxon9HE

    “In production” I have been using a Bash+xmlstarlet script, that I wanted to optimise by rewriting it into an XQuery script. This would be my 1st XQuery script after a couple of months of exercising XQuery through Priscilla Walmsley’s book and Saxon9HE – a couple of hours per week only because of my entire workload.

    During the last couple of days I managed to complete the rewriting of my utility. I acquired quite some experience, and now I am rather satisfied with my work – and myself  😎

    I learned, how to use regular expressions in XQuery – of course with decades of using regular expressions in various languages as a starting point.

    And I learned, how to use decimal number formatting – in 2 different technical “locales” in parallel. Apparently “left white space padding” of decimal numbers is something the creators of XQuery did not genuinely incorporate into the XQuery environment. Decimal number formatting in XQuery is rather different to how you do it in C or Perl, it resembles more how you do it in Fortran or COBOL – and I don’t mean to criticise that approach. All over it is just very, very different – and confusing, if it comes to details.

  • The SAXON XSLT and XQuery Processor

    The SAXON XSLT and XQuery Processor

    Downloaded Saxon-HE from the above URL on my Linux box, decided to go for the Java variant, installed saxonhe.jar and “the resources” into /usr/local/saxon-resources9-3.

    I wasn’t able to browse the documentation below saxon-resources9-3/doc with Chrome-10, so I use Firefox-3.6 for that.
    But I also read the documentation here.

    This is from “Getting started with Saxon on the Java platform”, adapted for my Unix-like platform:

    $ java -cp /usr/local/saxon-resources9-3/saxon9he.jar net.sf.saxon.Query -t ‘-qs:current-date()’

    Well, no error messages. I like that. Looks like I got all preconditions fulfilled.
    More command lines tries from there:


    $ cd /usr/local/saxon-resources9-3

    $ java -cp /usr/local/saxon-resources9-3/saxon9he.jar net.sf.saxon.Transform -t -s:samples/data/books.xml -xsl:samples/styles/books.xsl -o:$HOME/temp.html

    $ java -cp /usr/local/saxon-resources9-3/saxon9he.jar net.sf.saxon.Query -t -s:samples/data/books.xml -q:samples/query/books-to-html.xq > $HOME/temp.html

    (to be continued)