xsl-list
[Top] [All Lists]

Re: attributes and elements

2003-12-06 05:12:15
Bruce D'Arcus wrote:

<xsl:template match="node()" mode="filter-condition"/>

Ouch, had a bad day. This should be
 <xsl:template match="text()" mode="filter-condition"/>
in order to strip unwanted text nodes while filtering out
elements with the desired condition.

Alternatively, use the pull method
 <xsl:template match="section">
    <h1>
        <xsl:apply-templates select="title"/>
    </h1>
    <content>
      <xsl:for-each select=".//*[(_at_)type='screen']">
        <bullet>
          <xsl:value-of select="."/>
        </bullet>
      </xsl:for-each>
    </content>
 </xsl:template>

The latter is more compact and a bit easier to understand, while
the method using moded templates makes it easier to intercept
other elements for special processing (for example if there
is a <b> around your <q> and you want to have it to be effective).

J.Pietschmann



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



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