Category: XML

  • XQuery: padding an integer or a number, but not with “0”

    I found this function, but it pads on the right: http://www.xqueryfunctions.com/xq/functx_pad-string-to-length.html : functx:pad-string-to-length I derived pad-string-to-length-on-the-left from it: https://github.com/JochenHayek/misc/blob/master/xqueryfunctions/pad-string-to-length-on-the-left.xqy https://github.com/JochenHayek/misc/blob/master/xqueryfunctions I use it around format-integer and format-number, e.g. let $net_amount_formatted := local:pad-string-to-length-on-the-left( format-number( data($invoice/@net_amount) , ‘#,###.#####’ ) , ‘ ‘ , 12 )

  • XPath and XQuery Functions and Operators 3.0: Formatting integers and numbers

    https://www.w3.org/TR/xpath-functions-30 https://www.w3.org/TR/xpath-functions-30/#formatting-integers https://www.w3.org/TR/xpath-functions-30/#formatting-the-number http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html http://www.xqueryfunctions.com/xq/functx_pad-string-to-length.html https://github.com/JochenHayek/misc/blob/master/xqueryfunctions https://github.com/JochenHayek/misc/blob/master/xqueryfunctions/pad-string-to-length-on-the-left.xqy I need to pad a decimal number to a given length with leading white space. Looks like there is nothing in the “built-in library”. Looks like there is no functx:pad-integer-to-length as well, but functx:pad-string-to-length looks intriguing – but it only pads on the right. I created a variant, that pads on…

  • XmlStarlet UG on “Studying Structure of XML Document” – “xmlstarlet elements …”

    http://xmlstar.sourceforge.net/doc/UG/xmlstarlet-ug.html#idm47077139665568 http://xmlstar.sourceforge.net/doc/UG/xmlstarlet-ug.html I really like “xmlstarlet elements …” – but these very nice and useful XPath expressions come without index. So what if you really, really need them with indexes? I am not sure, you can write a general utility, that rewrites these XPath expressions without index into XPath expressions with index, but for my…

  • extract your build steps from a Jenkins CI job to ordinary and “easy to edit” flat files

    Over time Jenkins jobs can grow into something “a little confusing”, in other words: like cancer. The Jenkins developers were thoughtful enough to provide an API to all the data structures, that Jenkins and its jobs operate on, so we are able to export an entire Jenkins job as XML. You certainly do not want…

  • listing a Jenkins CI folder recursively

    https://github.com/JochenHayek/misc – pls find my script here! First I wrote this as a Shell script … calling XMLStarlet resp. SaxonHE (for XPath) and curl (for retrieving the Jenkins details as XML files). $ …/jenkins_find_jobs.sh https://integration.wikimedia.org/ci folder … freeStyleProject … matrixProject … The listing is quite helpful for documentational purposes. I was really proud on my little achievement…

  • RELAX-NG / jing-trang is “now” on github

    https://github.com/relaxng/jing-trang https://github.com/relaxng/jing-trang/wiki https://github.com/relaxng/jing-trang/wiki/How-to-build-from-source

  • an XQuery recipe: generating lots of documents in a single XQuery run …

    http://www.gnu.org/software/qexo/XQ-Gen-XML.html – search there for “Generate all the HTML output files“! … by putting them in a single large XML object – then use a post-processor to split this into separate files. (Alright this isn’t really a true “single XQuery run” approach. But it is close enough.) With Saxon-HE there is no way to write to separate text…

  • Xidel – yet another HTML/XML/JSON data extraction tool

    Xidel is a command line tool to download html/xml pages and extract data from them using CSS 3 selectors, XPath 3 expressions or pattern-matching templates. http://www.videlibri.de/xidel.html https://en.wikipedia.org/wiki/XQuery – I am “watching” the changes on this article, and somebody just added Xidel, that’s how I came across Xidel Cygwin’s and Fink’s repository do not have Xidel, but Xidel’s…

  • XQuery …

    https://en.wikipedia.org/wiki/XQuery http://www.xml.com/pub/a/2005/03/02/xquery.html – Bob DuCharme: Getting Started with XQuery http://shop.oreilly.com/product/0636920035589.do – O’Reilly Media book on XQuery, 2nd Edition https://en.wikibooks.org/wiki/XQuery https://www.w3.org/XML/Query/#implementations https://en.wikipedia.org/wiki/Saxon_XSLT – “Saxon is an XSLT and XQuery processor …“ https://sourceforge.net/projects/saxon/files/ https://sourceforge.net/projects/saxon/files/Saxon-HE/9.7/readme97.txt http://www.saxonica.com/documentation/index.html#!about/installationjava http://www.saxonica.com/documentation/documentation.xml http://www.saxonica.com/html/documentation/using-xquery/ http://www.saxonica.com/html/documentation/using-xquery/commandline.html

  • O’Reilly Media book: XQuery, 2nd Edition

    http://shop.oreilly.com/product/0636920035589.do http://www.datypic.com/books/xquery/examples.html – sample queries and XML files http://www.xqueryfunctions.com I am executing the examples with Saxon (“Home Edition”), e.g.: $ saxon net.sf.saxon.Query example0105.xqy It does help though to have a more serious look at Saxon’s “using XQuery” (on the command line) documentation. There are quite a few command line options, and some of them may be…