[xsl] Aargh - wrong template applied

Subject: [xsl] Aargh - wrong template applied
From: Ian Eure <ieure@xxxxxxxxxx>
Date: Tue, 18 Apr 2006 17:07:59 -0700
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm sure this is something simple I'm overlooking, but I just can't make this work.

I have this stylesheet:

<xsl:stylesheet version='1.0'
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
		xmlns:gale="http://www.gale.com/eBook";
		xmlns:php="http://php.net/xsl";
		exclude-result-prefixes="gale php">

    <xsl:output method="xml"
                version="1.0"
                indent="yes"
                encoding="utf-8"
                omit-xml-declaration="yes"/>

    <xsl:template match="@*|node()">
	<xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
    </xsl:template>

    <xsl:template match="font">
        <xsl:apply-templates/>
    </xsl:template>

</xsl:stylesheet>

I want to pass through the document as-is in most cases, but make certain changes elsewhere. I have a generic pass-through rule, and a more specific rule to strip out <font> elements, but retain their children. However, the latter template is never called, and I can't figure out why.

I'm using XSLTProc. Turning on it's verbose mode gives me some relevant information:

added pattern : '@*' priority -0.500000
added pattern : 'node()' priority -0.500000
added pattern : 'font' priority 0.000000

Looks good, but then:

xsltProcessOneNode: applying template '@*|node()' for font

Why isn't the latter template ever applied, and how do I get the behavior I want?

- --
Ian Eure
Developer,
eNotes.com LLC



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFERX9fxuUdPD6j2IMRAjcnAJ957AsILKXEZNC7JcwMa+LzoOeADgCfTjr4
esWfqHwRvCfITqeNmOeaUcQ=
=KsVw
-----END PGP SIGNATURE-----

Current Thread