xsl-list
[Top] [All Lists]

Re: [xsl] Filtering child text nodes by node name

2007-02-23 00:52:17
On 2/23/07, Anderson, Paul <Paul(_dot_)Anderson(_at_)compuware(_dot_)com> wrote:
<xsl:template match="title>
  <xsl:element name="topic-title">
     <xsl:for-each select=".//text()[not(ancestor::indexterm)]">
          <xsl:value-of select="."/>
     </xsl:for-each>
  </xsl:element>
</xsl:template>

I am glad my suggestion helped.

You could improve the readability a bit, by changing your code to following:

<topic-title>
  <xsl:for-each select=".//text()[not(ancestor::indexterm)]">
    <xsl:value-of select="."/>
  </xsl:for-each>
</topic-title>

xsl:element is usually used, when the element name is constructed
dynamically (sometimes based on some calculation).

--
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
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>