xsl-list
[Top] [All Lists]

[xsl] template match problem

2008-03-23 05:16:38
Hi All,

I have some input XML with the following structure:

<section id="54820" name="INSPECTION TECHNIQUES – KEY POINTS" fragresid="824033925" fragresverid="432002870"> <frag id="4861" name="HE.17133" type="text" fragresid="824033925" fragresverid="432002870">
                                        <lcij>
                                                <p style="Heading_3" 
xml:space="preserve"/>
                                                <p style="Heading_3" 
xml:space="preserve"/>
                                                <p style="Heading_3" 
xml:space="preserve">
<frag id="8" name="TOC Entry Marker" type="text" fragresid="824033895" fragresverid="824033896">
                                                                <p 
xml:space="preserve">
                                                                        
<advanced>
<xsl:variable xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; name="xslVarTocEntry"/>
                                                                        
</advanced>
                                                                </p>
                                                        </frag>
                                                </p>
                                                <p style="Heading_3" align="center" 
xml:space="preserve">
                                                        <b>INSPECTION TECHNIQUES – 
KEY POINTS</b>
                                                </p>
                                                <p style="Heading_3" align="center" 
xml:space="preserve"/>
                                        </lcij>
                                </frag>
<frag id="2362" name="GT.29704" type="text" fragresid="824033925" fragresverid="432002870">

...

My XSL has 3 template matches:

<xsl:template match="frag" priority="1">
<!-- do default action -->
</xsl:template>
<xsl:template match="frag[(_at_)name='TOC']" priority="2">
<!-- do TOC action -->
</xsl:template>
<xsl:template match="frag[(count (descendant::* [name() = 'frag']) = 0) and (count (descendant::* [name()='xsl:variable' and @name='xslVarTocEntry']) > 0)]" priority="2">
<!-- do TOC entry action -->
</xsl:template>

My question is why does the TOC entry template match against the highest level frag element (1st child of section) when it has a child frag element? The condition in the template match should forbid it and cause the default template (with lower priority) to match. What have I missed?

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>