Re: [xsl] Aargh - wrong template applied

Subject: Re: [xsl] Aargh - wrong template applied
From: Ian Eure <ieure@xxxxxxxxxx>
Date: Wed, 19 Apr 2006 10:45:01 -0700
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Apr 18, 2006, at 5:45 PM, J.Pietschmann wrote:

Ian Eure wrote:
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?

This may be a bug in xsltproc. You can try some voodoo and move the generic copy-through to the end of the style sheet. The order of the templates should only matter if there is a tie in the priority for matching patterns though. You could also try to assign a high positive priority to the font matching template. In either case, I'd ask on the relevant xsltproc specific list, maybe they have already a proper solution.
I thought it might be a bug as well, but it happens with every processor I've tried; Sablotron, Saxon, xsltproc, and Xalan-J.

I have tried:
- - Changing the priority of the passthrough rule to -999, and the priority of the font rule to 999.
- - Moving the templates around in the document.
- - Reversing the priorities, so the rule I wanted was -999 and the passthrough was 999.


They all resulted in the same behavior.

- --
Ian Eure
Developer,
eNotes.com LLC



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

iD8DBQFERncdxuUdPD6j2IMRAhNCAJ9q3I0FgVzD2LvCrT3toYDmf9U/DACdF/po
cctkD42wir7u6IVtwkUHuvk=
=ddzu
-----END PGP SIGNATURE-----

Current Thread