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

RE: text() and not()

Subject: RE: text() and not()
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 8 Jan 2002 11:54:29 -0000
RE:  text() and not()
> I have two points:
> 1.  //*[not(name()='title')] matches all elements apart from
> the text in <title>

The text in <title> isn't an element, it is text.
To be pernickety, you should really write this as //*[not(self::title)] to
avoid namespace problems.
>     //text()[not(name()='title')] matches all text, including that in
> <title>
> What xpath do I need to use to stop all text except that in <title>?

The name() of a text node is always "". You want


or alternatively


> 2.  If I use the default template to output the contents of
> <title>, how do
> I obtain the same sort of result as:
> <xsl:template match="para0/title">
>   <p class="title"><xsl:value-of select="."/></p>
> </xsl:template>
I don't understand. If you use the default (Built-in) template rule to
output <title> elements, it will just output the textual content of the
<title> element. If you want to wrap it in a <p> element, you must use a
template rule like the one you've shown us, you can't use the built-in
template rule.

Mike Kay

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

Current Thread


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.
First Name
Last Name
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.