Surprisingly, node() and text() have the same priority - this is true in
both XSLT 1.0 and 2.0.
It's also true in both 1.0 and 2.0 that it's a "recoverable error" to have
two template rules that match the same node with the same priority.
Different XSLT processors are allowed to treat "recoverable errors"
differently: they can report the error, or recover, in this case by choosing
whichever template rule comes last. Saxon by default gives you a warning
message and then takes the recovery action. If you want it to take the
recovery action silently, use the -w0 flag.
So the difference here is not one between XSLT 1.0 and 2.0, it's a
difference between the ways that Xalan and Saxon implement the specs.
It's a good idea to fix this error by setting an explicit priority on the
match="text()" template (or both).
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Beat Pfister [mailto:pfister(_dot_)b(_at_)merkurdruck(_dot_)ch]
Sent: 07 April 2006 10:35
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Edit text-nodes with XSLT 2.0
Hi,
I only want to edit the text-nodes of my xml-document, the
structure should
stay as is.
With XSLT 1.0 and Xalan 2.4.1, I used the following templates
and it works
well.
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()"> <!-- in the
text node the
replacement of characters with font tags is done-->
<xsl:choose>
<xsl:when test="not(string(.))" />
<!-- test if
textcontent is empty -->
<xsl:otherwise>
<xsl:call-template name="find_char1" >
Some more stuff ...
</xsl:otherwise> <!-- end textcontent
is not empty
-->
</xsl:choose>
</xsl:template>
Then I changed to XSLT 2.0 and Saxon 8.6.1 and the templates
do not work any
more.
The Error message displayed:
Recoverable error on line 99 of
file:/D:/work/ige/fo/26_spa/../Programme/fo/v_0.7/xmltoxml_font.xsl:
XTRE0540: Ambiguous rule match for
/ch-patent-document/bibliographic-data[1]/text()[1]
Matches both "text()" on line 108 of
file:/D:/work/ige/fo/26_spa/../Programme/fo/v_0.7/xmltoxml_font.xsl
and "node()" on line 98 of
file:/D:/work/ige/fo/26_spa/../Programme/fo/v_0.7/xmltoxml_font.xsl
Any help much appreciated.
Regards,
Beat
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--