[xsl] Transformation from XSL1 to XSL2 error

Hi, I need to transform some XSL1 stylesheets to XSL 2 to use them with Saxon 8.7.3. I changed the version in the declaration and some little other things, but, obviously, it's not enough... I have an error which's making me crazy...
An attribute node (color) cannot be created after the children of the containing element The transformation failed due to an XML parsing or transformation error.
It seems to be about this part of my XSLs :
<xsl:template name="process.change"> <xsl:param name="CHG"></xsl:param> <xsl:if test="$CHG='ADD'"> *<xsl:attribute name="color">red</xsl:attribute> (Especially this line!)* </xsl:if> <xsl:if test="$CHG='MOD'"> <xsl:attribute name="color">orange</xsl:attribute> </xsl:if> </xsl:template>
I don't understand what's the problem with color attribute node... I searched again and again with google... Some users have the same error but I don't understand how to resolve it in my case. Someone could help me, please? Thanks!!! Damien G.

On 28/03/2008, Dam's <ptidams@gmail.com> wrote:
<xsl:template name="process.change"> <xsl:param name="CHG"></xsl:param> <xsl:if test="$CHG='ADD'"> <xsl:attribute name="color">red</xsl:attribute>
The problem will be that the template is being called after you've added a child node to the containing element - so check where this template is being called. Adding attributes using a named template like this is always a bad idea - post the template with the calling code and it's likely it can be re-written to use apply-templates. I've just noticed you've asked this on the oxygen list - you should consider using the xsl-list for xsl specific questions: http://www.mulberrytech.com/xsl/xsl-list/ cheers -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
participants (2)
-
Andrew Welch
-
Dam's