This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: wildcards in xpath?
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: inchi2000 at gmx dot de
- Cc: XSL-List at lists dot mulberrytech dot com
- Date: Wed, 24 Jul 2002 14:33:05 +0100
- Subject: Re: [xsl] wildcards in xpath?
- Organization: Jeni Tennison Consulting Ltd
- References: <24000.1027516320@www44.gmx.net>
- Reply-to: xsl-list at lists dot mulberrytech dot com
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