[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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 //text()[not(parent::title)] or alternatively //*[not(self::title)]/text() > > 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|