xsl-list
[Top] [All Lists]

Re: XSL design question

2003-09-02 12:09:28
Hi Pete,
[...]
<!ELEMENT title (#PCDATA | b | i | tt | index)*>
[..]
This won't work either:

<xsl:apply-templates select="*[not(self::index)]"/>

How doesn't it work? It should, in "title" context, because it means apply 
templates to every child that isn't an index. eg

<xsl:template match="title">
        <xsl:apply-templates select="*[not(self::index)]"/>
</xsl:template>

[...]
This, too will not work:

<xsl:apply-templates select="*[not(descendant::index)]"/>
[...]
This shouldn't work (if the context node is a "title") because it means apply 
templates to all children that don't have an index descendant. 

You could use modes, just as you suggested:
<xsl:template match="title">
        <xsl:apply-templates mode="toc"/>
</xsl:template>
<xsl:template match="i|b|tt" mode="toc">
        <!-- do something -->
</xsl:template>
<xsl:template match="index" mode="toc"/> <!-- do nothing -->

Some very organised people use modes all the time, except for the first 
template that matches /.

Tom SW
--
"The facts are hideous, but we must face them" - Bertie Wooster


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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