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

Re: XPath expression "everything but..." ?

Subject: Re: XPath expression "everything but..." ?
From: "Michael Beddow" <mbnospam@xxxxxxxxxxx>
Date: Wed, 14 Feb 2001 15:31:09 -0000
xpath everything but an element
On Wednesday, February 14, 2001 10:47 AM
Fridiric SCHWEBEL wrote:

> Is it possible to have an XPath expression that means "every child
but one"
> ?
[..]
> <xsl:template match="chapter">
>    <H1><xsl:apply-templates select="title" /></H1>
>    <xsl:apply-templates select="* but not title" />
> </xsl:template>
>
Jiri and Francis have provided general solutions (which was what you
asked for) But if the only reason you want to exclude the <title>
element is that you want it, and it alone, to be in an html <h1>
element, there's another way (which may just be less
processor-intensive, I don't know)

Simplify your template to
<xsl:template match="chapter">
    <xsl:apply-templates/>
 </xsl:template>

Then provide a template matching on "title" (or maybe chapter/title,
depends on your document structure)
that does <h1><xsl:apply-templates/></h1>

Sometimes I think we get a bit carried away with all these clever
brackety quotey thingies. Not everything that works in XSLT is
visually terrifying...

Michael
------------------------------------------
Michael Beddow
http://www.mbeddow.net/


 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.