Re: [xsl] XSLT 2.0 compability issue occured in topicmerge.XSL in DITA OT1.5.1.

Subject: Re: [xsl] XSLT 2.0 compability issue occured in topicmerge.XSL in DITA OT1.5.1.
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Mon, 24 Sep 2012 12:45:53 +0100
Have you checked whether this is fixed in a later DITA release? You're using quite an old one.

If it reproduces with the latest DITA stylesheets, then it might be useful to post sufficient information so that other people can reproduce the problem and perhaps diagnose the bug.

With Saxon, the best way of diagnosing the bug is to run with the -T option. This produces very voluminous trace output, of which the interesting part is the last few instructions executed before the failure occurred.

Note that it's not entirely accurate to describe this as an XSLT 2.0 compatibility issue; it's more of a 1.0 interoperability issue that was fixed in 2.0. Writing an attribute after writing children of an element was an error in XSLT 1.0: "implementations may either signal the error or ignore the attribute", so the stylesheet would fail with some XSLT 1.0 processors and "succeed" with others. What has changed in 2.0 is that all processors are required to behave in the same way (by reporting the error).

Michael Kay
Saxonica

On 24/09/2012 11:43, team wise wrote:
Hi there,
I am stuck in a prolem with the XSLT 2.0 stylesheet which Michale has
commented on earlier, the thread reads: XSLT 2.0 compability issue
occured in topicmerge.XSL in DITA 1.5.1.
http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/201206/msg00161.html
Now a similar problem occurs:

Problem: Publishing publications with sub-map structures failed.
Log:
[xslt]
topicmerge.xsl:210:
Fatal Error! An attribute node (role) cannot be created after the
children of the containing element
Background:
An expected XML skeleton within a MERGED.XML structure shall be as follows:
<related-links>
<linkpool>
<link role="child">
<linktext>ABC</linktext>
<desc>ABCD</desc>
</link>
</linkpool>
</related-links>
Below lines are where the failure occurs:

<xsl:template match="*|@*|comment()|processing-instruction()|text()"
mode="copy-element">
<xsl:param name="src-file"></xsl:param>
<xsl:copy>
<xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"
mode="copy-element">
<xsl:with-param name="src-file"><xsl:value-of
select="$src-file"/></xsl:with-param>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>

When I applied the nested Elements as follows, the build always points
me to the same line of failure:

<!--@role fixes somc start-->
<xsl:template match="*[contains(@class,' map/topicref ')][@role]">

<xsl:element name="link">
<xsl:apply-templates select="@role" mode="copy-element"/>
<xsl:attribute name="refclass"><xsl:value-of
select="$topicrefClass"/></xsl:attribute>
<xsl:apply-templates select="*" mode="copy-element"/>
<!--xsl:apply-templates select="@role" mode="copy-element"/-->
<xsl:element name="linktext"> <xsl:apply-templates select="@*"
mode="copy-element"/> </xsl:element> <desc/> </xsl:element>

<xsl:apply-templates/>
</xsl:template>

My question ,  how to overwrite the above line of '
<xsl:apply-templates
select="*|@*|comment()|processing-instruction()|text()"
mode="copy-element"> so it can ' forcefully injecting the XSL
related-links, Linkpool, Link, Linktexst plus DESC elements plus their
associated attributes'?

I look forward to hearing from you again.

Current Thread