[xsl] Inverse of apply-template select

Subject: [xsl] Inverse of apply-template select
From: russurquhart1@xxxxxxxxxxx
Date: Thu, 13 Jan 2011 12:51:01 -0600 (CST)
I have an unprofiled docbook xml file i am trying to convert to my companys xml format, that is similar to docbook.

The xml file i have is of the following:

<book>
<title>...</title> 
<title>...</title> 
<title>...</title> 
.
.
.
<bookinfo>...</bookinfo>
<bookinfo>...</bookinfo>
<bookinfo>...</bookinfo>
...
<article>...</article>
...
</book>

I have templates to handle all the elements in the docbook file, and convert to our formats. One of the unique things about our xml, is that the bookinfo element, is renamed to userdocinfo, and MUST come before the title element. The rest of the elemtents are effectively renamed in situ.

So, for my book template i have the following:

<xsl:template match="book">
   <UserDoc>
      <xsl:apply-templates select="./bookinfo"/>
      <xsl:apply-templates select="./title"/>
         <GenSection>   

<!-- This line doesn't work. -->

            <xsl:apply-templates select="*[not(./bookinfo) or not(./title)]"/>

         </GenSection>
   </UserDoc>
</xsl:template>

I use the select attribute of the xsl:apply-templates to reorder and process bookinfo and title elements.

I want to then apply templates to the rest of the elements, EXCEPT the ones i just processed. I know this is just a matter of finding the right xpath for the select attribute, but i can't seem to find it.

Can anyone give me a little help or hint on this?

Thanks again for all your help!


Russ

Current Thread