“Content is not allowed in prolog” error yet nothing before XML declaration

Elaborating on what @MartinHonnen has already helpfully commented… The error, Content is not allowed in prolog. arises because the XML prolog, which is everything before the root element in an XML document, has textual content that is not allowed. The error does not necessarily have to have occurred before the XML declaration. Specifically, the prolog … Read more

Use saxon with python

There are two possible approaches: set up an HTTP service that accepts tranformation requests and implements them by invoking Saxon from Java; you can then send the transformation requests from Python over HTTP use the Saxon/C product, currently available on prerelease: details here: http://www.saxonica.com/saxon-c/index.xml

How to execute XSLT 2.0 with ant?

The problem is that while Saxon is added to the classpath, the default JAXP mechanism to determine which TransformerFactory is used and it will use the default that is Xalan. You either need to: Set javax.xml.transform.TransformerFactory system variable to net.sf.saxon.TransformerFactoryImpl, Add saxon9.jar to the CLASSPATH system variable, or Use <factory name=”net.sf.saxon.TransformerFactoryImpl”/> inside the xslt element

XSLT: moving a grouping html elements into section levels

Here is an XSLT 2.0 stylesheet: <xsl:stylesheet xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” xmlns:xs=”http://www.w3.org/2001/XMLSchema” xmlns:mf=”http://example.com/mf” exclude-result-prefixes=”xs mf” version=”2.0″> <xsl:output indent=”yes”/> <xsl:function name=”mf:group” as=”node()*”> <xsl:param name=”elements” as=”element()*”/> <xsl:param name=”level” as=”xs:integer”/> <xsl:for-each-group select=”$elements” group-starting-with=”*[local-name() eq concat(‘h’, $level)]”> <xsl:choose> <xsl:when test=”self::*[local-name() eq concat(‘h’, $level)]”> <section level=”{$level}”> <xsl:element name=”header{$level}”><xsl:apply-templates/></xsl:element> <xsl:sequence select=”mf:group(current-group() except ., $level + 1)”/> </section> </xsl:when> <xsl:otherwise> <xsl:apply-templates select=”current-group()”/> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> … Read more