Selecting an complementary set of nodes

Subject: Selecting an complementary set of nodes
From: Ragnar Schierholz <raschi@xxxxxxxxx>
Date: Tue, 27 Jun 2000 14:39:09 -0500
Hi !
Is it somehow possible to invert the result of node set rsulting from an
XPath expression?

To be a little more specific, I have a node with multiple children of
different element types. One child of one type is mandatory, all the others
are optional but can occur in unlimited numbers. In fact, the element type
looks somehow like this in the DTD:

<!ELEMENT question

That means a <question> element contains exactly one stem and a child of
any of the listed types where the <combination> element can contain any
combination of the previous. Thus, as descendants of question, all the
other types can occur again.

What I need to do is processing the <stem> child first and then later all
the other children. What I do currently looks like this:

     <xsl:template match="question" mode="HTML">
     <xsl:variable name="questionIndex"><xsl:value-of select
          <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" BGCOLOR="#A3892A">
          <xsl:comment>Begin table question <xsl:value-of select="
                 <TD WIDTH="1%" VALIGN="TOP">
                    <DIV CLASS="question">
                         <xsl:value-of select="$questionIndex"/>.
                   <xsl:apply-templates select="child::stem" mode
                 <TD WIDTH="1%"><FONT COLOR="#A3892A">.</FONT></TD>
                   <xsl:apply-templates select="radioMatrix" mode="HTML"/>
                   <xsl:apply-templates select="radioList" mode="HTML"/>
                   <xsl:apply-templates select="checkList" mode="HTML"/>
                   <xsl:apply-templates select="freeText" mode="HTML"/>
                   <xsl:apply-templates select="alphaMatrix" mode="HTML"/>
                   <xsl:apply-templates select="selectList" mode="HTML"/>
                   <xsl:apply-templates select="combination" mode="HTML"/>
          <xsl:comment>End table question <xsl:value-of select="

But I am somewhat unhappy with the explicit listing of all children element
types because later on, I might want to add some and that would then
require to also change this part. Is there a way to select all the children
except for those of type <stem>, or in other words the complementary set of
children to child::stem?

Thanks for your help,

 XSL-List info and archive:

Current Thread