Re: [xsl] Searching text within a node

Subject: Re: [xsl] Searching text within a node
From: "Lee" <lee@xxxxxxxxxxxxx>
Date: Thu, 06 Aug 2009 16:45:30 -0500
Shaaweet! Worked like a charm. Thank you.

I was close on my own with
<xsl:if test="'Smith'=Form/Names/LastName or test=not(Form/Names/LastName)">
which did not work.



On Thu, 06 Aug 2009 17:12:35 -0400 Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> wrote:
Lee,

You can test whether a node set is empty by using the not() operator, as in

test="not(Form/Names/LastName)"

which would be true if no LastName elements existed. You could connect that with an 'or':

<xsl:if test="'Smith'=Form/Names/LastName or not(Form/Names/LastName)">

This passes if 'Smith' is found as a value on a node in the set (Form/Names/LastName), or if that set is empty (no such nodes exist).

That may not be exactly what you want, however. You need to specify exactly what you mean by the "non-existence of the node <LastName>".

Cheers,
Wendell

At 04:13 PM 8/6/2009, you wrote:
I have one more problem. I also need to test for the non-existence of the node <LastName> using an "or" on the "if" statement.

So something like <xsl:if test="'Smith'=Form/Names/LastName or ">

Thanks.





======================================================================
Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread