xsl-list
[Top] [All Lists]

Template priority problem

2005-09-06 08:38:24
I have a requirement to copy a source XML input file but adjust just a couple of elements in the file. I thought this would be real simple but I can't get it to work. I have two templates, one specific to match elements I want to change and a identity transform one. Here is the XSL I have:

<xsl:template match="field" priority="2">
        <xsl:variable name="fieldindex" select="@index"/>
<xsl:variable name="fieldname" select="ancestor::dataSet/fielddefinition[$fieldindex]/@label"/>
        <field>
                <xsl:value-of select="."/>
        </field>
</xsl:template>
<xsl:template match="* | comment() | text() | processing-instruction() | @*" priority="1">
        <xsl:copy>
<xsl:apply-templates select="* | comment() | text() | processing-instruction() | @*"/>
        </xsl:copy>
</xsl:template>

The problem is the template that matches field elements is always ignored, despite the higher priority! So I just get an exact copy of the input XML. Can someone explain why this is and offer a simple solution to my requirement.

Thanks,

Chris



--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>