This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: search condition
- From: Joerg Heinicke <joerg dot heinicke at gmx dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 06 Mar 2002 11:36:58 +0100
- Subject: Re: [xsl] search condition
- References: <F174Mj15l9gevccVTLm00004c28@hotmail.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Why don't you easily test it? It's absolutely correct.
Only 2 comments:
1. '.' means all descendant text-nodes of the current node. In your case
it causes no problem, but '.' of <root> is 'ABCDEFABCFGHABC'. So using
'text()' instead of '.' is safer.
2. Why are you using '//root...'? '//' searches the root and all
descendants - so all nodes in your XML - for this pattern. Remove one of
the slashes and it will be correct too - and with big XML-files very
much faster.
Regards,
Joerg
Laura Jenkins wrote:
>
>
> Dear people,
> forgive me if my question is very basic.
>
> i want to search the element textid which has a text = 'ABC'
>
> can i acheive this by the for-each condition
>
> <xsl:for-each select="//root/children/textid[.='ABC']">
>
> xml structure being
>
> <root>
> <children>
> <textid>ABC</textid>
> </children>
> <children>
> <textid>DEF</textid>
> </children>
> <children>
> <textid>ABC</textid>
> </children>
> <children>
> <textid>FGH</textid>
> </children>
> <children>
> <textid>ABC</textid>
> </children>
> </root>
>
> please correct me if i am wrong
> i am writing the xsl like below
>
> <xsl:for-each select="//root/children/textid[.='ABC']">
> <!-- to print the text -->
> <xsl:value-of select="."/>
> </xsl:for-each>
>
> many thanks in advance
> laura
--
System Development
VIRBUS AG
Fon +49(0)341-979-7411
Fax +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list