One way I can think of is using xsl:when.  In the test case you might be
able to do something like

<xsl:variable name="myName" select="name(current())"/>
<xsl:choose>
        <xsl:when test="$myName != DDD | $myName != XXX">
                <!-- I guess here you would print out whatever -->
        </xsl:when>
</xsl:choose> 

This would filter out any unwanted elements.


Christian

-----Original Message-----
From: Enric Jaen [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 18, 2006 6:23 AM
To: xalan-j-users@xml.apache.org
Subject: how to filter elements in XPath

Hi,
Is there any way to filter the child elements of a given Xpath
expression? (without using multiple paths)

For example, having this:

<AAA>
  <BBB/>
  <CCC/>
  <DDD/>
</AAA>

I'd like to return AAA with only BBB and CCC elements, like this:

<AAA>
  <BBB/>
  <CCC/>
</AAA>


Regards,
-Enric

Reply via email to