[xsl] Confusing trace from Saxon HE9

Subject: [xsl] Confusing trace from Saxon HE9
From: Jeroen Hellingman <jeroen@xxxxxxxx>
Date: Tue, 08 Dec 2009 20:58:56 +0100
I am working with a rather complex stylesheet to split a TEI document into pieces for an epub file, and get the following trace on an error.

Error on line 204 of splitter.xsl:
XPTY0004: A sequence of more than one item is not allowed as the first argument of
generate-id() (<p/>, <p/>)
at xsl:call-template name="content.div1" (file:/C:/Users/Jeroen/Documents/eLibrary/Tools/tei2html/splitter.xsl#180)
at xsl:apply-templates (file:/C:/Users/Jeroen/Documents/eLibrary/Tools/tei2html/splitter.xsl#94)
processing /TEI.2/text[1]/body[1]/div0[1]/div1[1]
at xsl:apply-templates (file:/C:/Users/Jeroen/Documents/eLibrary/Tools/tei2html/splitter.xsl#71)
processing /TEI.2/text[1]/body[1]/div0[1]
at xsl:apply-templates (file:/C:/Users/Jeroen/Documents/eLibrary/Tools/tei2html/splitter.xsl#41)
processing /TEI.2/text[1]/body[1]
at xsl:apply-templates (file:/C:/Users/Jeroen/Documents/eLibrary/Tools/tei2html/header.xsl#47)
processing /TEI.2/text[1]
at xsl:apply-templates (file:/C:/Users/Jeroen/Documents/eLibrary/Tools/tei2html/tei2epub.xsl#88)
processing /TEI.2
Transformation failed: Run-time errors were reported


The thing that is confusing me is that line 204 in my stylesheet is not called from the template "content.div1" mentioned on the line before.

Can you give me a hint on how to interpret this trace, as I do not understand how a

<xsl:call-template name="content.div1"/>

brings me into a template

<xsl:template name="filename.div0fragment">

Furthermore, the failing template receives two nodes in a variable that I hardly expect to be grouped together. In the source document they are not even siblings.


The full stylesheet in question is here: http://code.google.com/p/tei2html/source/browse/trunk/splitter.xsl


The document it is fed (via another top-level stylesheet, tei2epub.xsl) is here: http://code.google.com/p/tei2html/source/browse/trunk/test.xml

The offending lines in the input document causing the issue is at lines 104-111:

<q rend="block"><text><body><div1><head>Section head in quoted material</head>

<p>This is a paragraph in quoted material<note>This is a footnote in quoted material.</note> This paragraph contains a footnote, to verify correct handling of this convoluted situation during the transformation.</p>
</div1></body></text></q>



<p>Books created with these stylesheet include: ....</p>


Current Thread