Limitations of Eric van der Vlist's RelaxNG simplicification

268 views Asked by At

All,

I am trying to simplify a RelaxNG schema using Eric van der Vlist's simplification.xsl, but I'm getting errors:

runtime error: file ./simplification.xsl line 741 element element
xsl:element: The effective name '' is not a valid QName.
runtime error: file ./simplification.xsl line 751 element element
xsl:element: The effective name '' is not a valid QName.
runtime error: file ./simplification.xsl line 759 element element
xsl:element: The effective name '' is not a valid QName.
runtime error: file ./simplification.xsl line 759 element element
xsl:element: The effective name '' is not a valid QName.
runtime error: file ./simplification.xsl line 759 element element
xsl:element: The effective name '' is not a valid QName.

It seems it has something to do with some names getting constructed dynamically:

<xsl:template match="rng:start[not(preceding-sibling::rng:start) and following-sibling::rng:start]" mode="step7.18">
        <xsl:copy>
                <xsl:apply-templates select="@*" mode="step7.18"/>
                <xsl:element name="{parent::*/rng:start/@combine}">
                        <xsl:call-template name="start7.18"/>
                </xsl:element>
        </xsl:copy>
</xsl:template>

I haven't started getting into it any deeper, but perhaps someone already has a clue on what might be causing this.

2

There are 2 answers

0
Wilfred Springer On BEST ANSWER

Apparently, I wasn't the first one to run into these issues. This web site also refers to some problems running simplification.xsl, and includes some fixes. I'm just copying it in here, for future reference.

  • In step 10 : prefix "rng:" was missing in lines <xsl:with-param name="node-name" select="'rng:group'"/> resulting with markups <group> with default namespace (which is not RelaxNG) in output.
  • In step 14 : add concatenation of prefix "rng:" before value of "combine" attributes in lines <xsl:param name="node-name" select="concat('rng:',parent::*/rng:start/@combine)"/>.
  • In step 14 : In template <xsl:template match="rng:start[not(preceding-sibling::rng:start) and following-sibling::rng:start]"> I removed the element addition <xsl:element name="{parent::*/rng:start/@combine}"> because it results to an extra <rng:choice> surrounding the other <rng:choice> inside the <rng:start>.
  • In step 15 : seems that template <xsl:template match="/*"> has a higher priority than template <xsl:template match="/rng:grammar">, so I had to add a precision : <xsl:template match="/*[not(self::rng:grammar)]">.
  • In step 15 : missing "rng:parentRef/@name" in erasing template : <xsl:template match="rng:define|rng:define/@name|rng:ref/@name|rng:parentRef/@name"/> in order to keep the id generated in "name" attribute of <parentRef>.

After copying in my original RelaxNG grammar in the given web site, the whole transformation completes without any problem.

2
John Cowan On

Is there some reason not to use jing -s instead?