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

RE: Grouping text nodes

Subject: RE: Grouping text nodes
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 4 Aug 2005 18:03:32 +0100
RE:  Grouping text nodes
You could also write this as

*[span/@class='vn']

Some people might find that more intuitive (though I'm not sure why).

Michael Kay
http://www.saxonica.com/

 

> -----Original Message-----
> From: Jacoby, Peter R. [mailto:PJACOBY@xxxxxxxxxxxx] 
> Sent: 04 August 2005 17:13
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  Grouping text nodes
> 
> >> > <xsl:template match="*[span[@class='vn']]" mode="lg">
> >>
> >>What are the extra [ ] doing in this case? 
> 
> I've found that understanding XPath statements is easiest if 
> you try to turn it
> into English (or your favorite spoken language) going left-to-right.
> 
> So, match="*" means match on any node
>  
> *[...] means match on any node where the ... evaluates to true
> 
> *[span] means match on any node where it is true that it has 
> a child named span
> 
> *[span[...]] means match on any node where it is true that is 
> has a child named
> span and for which the ... evaluates to true for that span child
> 
> *[span[@class='vn']] means match on any node where it is true 
> that is has a
> child named span and that span child has an attribute named 
> class whose text
> value is equal to the string "vn"
> 
> I know this was probably more verbose than you needed, but 
> this is the concept
> of breaking down XPath into its various parts that has helped 
> me learn it.
> 
> Hope this helps.
> 
> -Peter

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.