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

apply-templates select question

Subject: apply-templates select question
From: "Hunter, David" <dhunter@xxxxxxxxxxxx>
Date: Tue, 15 Jun 1999 11:14:12 -0400
apply templates select
I have a [hopefully] simple question, regarding the apply-templates element.
Consider the following snippet of XML, and the XSL after it:

XML:

<TheRestOfTheDocument>
  <Features>
    <Count>2</Count>
    <ID Description="c">1256</ID>
    <ID Description="A">1892</ID>
  </Features>
</TheRestOfTheDocument>

XSL:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
  <xsl:template>
    <xsl:copy>
      <xsl:apply-templates select="@* | * | text()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="/TheRestOfTheDocument/Features">
    <xsl:copy>
      <xsl:apply-templates select="Count"/>
      <xsl:apply-templates select="ID" order-by="+@Description"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

As you can see, what I want to do is sort the "ID" elements by their
"Description" attribute.  However, I also need to include that "Count"
attribute, so I need a separate apply-templates just for it.

My question is, can I create an apply-templates that will copy everything
EXCEPT the "ID" attributes?  So instead of 

<xsl:apply-templates select="Count"/>

I want something similar to

<xsl:apply-templates select="not(ID)"/>

(which, obviously, doesn't work.  At least, not with the IE5 XSL processor.)

The reason for this is that I'm sorting various sections of a very large
document, with a lot of similar scenarios, except that some of them might be
set up more like this:

<Blah>
	<something1/>
	<something2/>
	<.../>
	<somethingn/>
	<ID Description="c">1</ID>
	<ID Description="A">2</ID>
</Blah>

and I don't want to have to do a separate apply-templates for each
"something".

As I mentioned, I'm using the IE5 XSL processor, if it makes a difference.
Following are some of the misguided syntaxes I tried to use, none of which
worked:

select="not(ID)"
select="[not(ID)]"
select="[* && not(ID)]"
select="[* $and$ not(ID)]"

Thanks in advance for any light you can shed.

David Hunter
david.hunter@xxxxxxxxxxxxx
MediaServ Information Architects
http://www.MediaServ.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.