Subject: Re: [xsl] template match problem From: Chris Bowditch <bowditch_chris@xxxxxxxxxxx> Date: Sun, 23 Mar 2008 15:05:43 +0000 |
I am not able to reproduce the problem, I took your XML snippet and added a closing </section>, then I made this stylesheet with your three templates given a body indicating what happens
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="section"> <root> <xsl:apply-templates/> </root> </xsl:template>
<xsl:template match="frag" priority="1"> <template match="frag" priority="1"/>
</xsl:template>
<xsl:template match="frag[@name='TOC']" priority="2">
<template match="frag[@name='TOC']" priority="2"/>
</xsl:template>
<xsl:template match="frag[(count (descendant::* [name() = 'frag']) = 0) and (count (descendant::* [name()='xsl:variable' and @name='xslVarTocEntry']) > 0)]" priority="2">
<template match="frag[count ..." priority="2"/>
</xsl:template>
</xsl:stylesheet>
and run it with Saxon 6.5, the result is
<?xml version="1.0" encoding="utf-8"?><root> <template match="frag" priority="1"/> <template match="frag" priority="1"/> </root>
Can you post a minimal but complete XML input and stylesheet and tell us which XSLT processor you use and how you check which template is choosen?
Also note that the conditions in the third template could be rewritten as
<xsl:template match="frag[not(descendant::frag) and descendant::xsl:variable[@name='xslVarTocEntry']]"
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] template match problem, Martin Honnen | Thread | [xsl] [XSL] How to test "numericity, Alain |
Re: [xsl] template match problem, Martin Honnen | Date | [xsl] [XSL] How to test "numericity, Alain |
Month |