[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Filtering child text nodes by node name

Subject: Filtering child text nodes by node name
From: "Anderson, Paul" <Paul.Anderson@xxxxxxxxxxxxx>
Date: Thu, 22 Feb 2007 13:02:29 -0500
 Filtering child text nodes by node name
Greetings All,

I am processing the following sample source:

...
<title>Configuring the <command>process</command> command
  <indexterm>
    <primary>In title</primary>
    <secondary>first</secondary>
  </indexterm>
  <indexterm>
    <primary>In title</primary>
    <secondary>second</secondary>
  </indexterm>
</title>
...

I already have scripting in place to process the <indexterm> elements
inside the <title> and move them to another location in the output. The
problem is that I need to output a title that ignores the child elements
but retains their content but _not_ if the child element is an
indexterm. The output I need is:

<topic-title>Configuring the process command</topic-title>

Naturally, I started with something like the following:

<xsl:template match="title>
   <xsl:element name="topic-title">
	<xsl:value-of select="."/
   </xsl:element>
</xsl:template>

Which generated the output:
<topic-title>Configuring the process commandIn titlefirstIn
titlesecond</topic-title>

I've been playing around with various predicates on text nodes but they
don't provide the desired output. For example:

<xsl:template match="title>
   <xsl:element name="topic-title">
	<xsl:value-of select="./text()[not(ancestor::indexterm)]"/
   </xsl:element>
</xsl:template>

Generates the following output:
<topic-title>Configuring the </topic-title>

Any assistance is appreciated.

Best regards,

Paul Anderson
Compuware Corporation
The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.