[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: wildcards in xpath?
Hi Markus, > I have a short question to xpath. Is it possible to select all nodes > which begin with "dino"? I want to do something like this: > <xsl:for-each select="dino*"> You can select all nodes that are children of the current node with: node() Then you can filter them with a predicate, which is a boolean expression held in square brackets -- if the expression evaluates as true for the node then the node is retained, if it evaluates as false, then the node is ignored: node()[...] Then you can test whether the context node's value starts with a particular string using the starts-with() function, which takes two arguments -- the string that you want to test, and the string that it should start with. You can use the shorthand . to indicate "the value of the node I'm looking at". So try: node()[starts-with(., 'dino')] Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ 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
|