Validating XSL-FO

Inasmuch as it’s something that people ask for, I demoed in the DemoJam at XML Prague that I’d been working on a Relax NG schema and Schematron rules for validating XSL-FO. Most of both the schema and the Schematron were generated directly from the XML source for the XSL 1.1 Recommendation. Additionally, the Schematron used a parser written in XSLT for handling the XSL-FO expression language, so the Schematron could evaluate property values rather than just matching on property value strings.

Relax NG and Schematron validation in oXygen

There was also an oXygen add-on framework in the works, and, naturally, the schema and Schematron also covered Antenna House extensions.

If you look at the screenshot, you’ll see:

  • Schematron error for the interrelated <axf:document-info> elements.
  • No error for ‘column-count="-1 - -2"‘ because the value evaluates as a positive integer.
  • oXygen ‘tooltip’ information for fo:block extracted from the XML for the XSL 1.1 Recommendation.
  • The ‘neutral’ and ‘out-of-line’ formatting objects, as well as the XSL 1.1 ‘point’ fo:change-bar-begin and fo:change-bar-end formatting objects that can appear anywhere inside a fo:flow, are available where they are allowed.
  • Schematron error for the invalid font-size value.

Flymake for RELAX NG compact syntax

Inasmuch as the Wisent parsing and other CEDET/Speedbar/Semantic goodness for RELAX NG compact syntax files that I’m currently working on may not be ready for prime time for a while, here’s something to add to your .emacs so `flymake' runs Jing in the background to find syntax errors in your RELAX NG compact syntax files:

(require 'flymake)
(defun flymake-rnc-init ()
  (let* ((temp-file (flymake-init-create-temp-buffer-copy
		     'flymake-create-temp-inplace))
     	 (local-file (file-relative-name
		      temp-file
		      (file-name-directory buffer-file-name))))
    (list "jing" (list "-c" local-file))))
(add-to-list 'flymake-allowed-file-name-masks
      '(".+\\.rnc$"
	flymake-rnc-init
	flymake-simple-cleanup
	flymake-get-real-file-name))
(add-hook 'rnc-mode-hook
	  'flymake-mode)