[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Do some elements contain strings from other elemen
Subject: Re: Do some elements contain strings from other elements?
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 27 Jan 2011 11:54:47 -0500
|
Hi,
Is it time once again to mention the existence of the Mulberry XSLT
Quick References? In handy PDF format available from:
http://www.mulberrytech.com/quickref/index.html
The XSLT 1.0 Quick Ref there includes XPath 1.0, with boolean() among
the other functions. (Note however that implicit casts to Boolean values
are quite common in XPath 1.0, and you often get this function for free,
without asking.)
There are references there for other members of the XSLT/XPath family as
well.
Regards,
Wendell
On 1/27/2011 10:50 AM, W Charlton wrote:
Languishing in the xsl1 backwaters I've been watching the pack move away and
had actually assumed that boolean() didn't work in XSL1. It's a problem
because I see these neat solutions on the xsl-list and most of the time now
they are xsl2 only.
You live and learn:)
William Charlton
The yMonda team
yMonda Limited
w: www.ymonda.net
-----Original Message-----
From: Andrew Welch [mailto:andrew.j.welch@xxxxxxxxx]
Sent: 27 January 2011 15:33
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: Do some elements contain strings from other elements?
Hi Martin,
On 27 January 2011 15:25, Martin Honnen<Martin.Honnen@xxxxxx> wrote:
W Charlton wrote:
I have the following XML.
<XML>
<SplitNameList>
<SplitName>
<GivenName>ANDREW</GivenName>
<FamilyName>SMITH</FamilyName>
</SplitName>
<SplitName>
<GivenName>DONALD</GivenName>
<FamilyName>DUCK</FamilyName>
</SplitName>
</SplitNameList>
<FulNameList>
<FullName>DAVID JONES</FullName>
<FullName>ANDREW J SMITH</FullName>
<FullName>JOHN SMITH</FullName>
</FulNameList>
</XML>
I need to know if any of the Family Names match in the two lists. Either
of these two lists could be quite long and this is in the middle of a
load
of logic. All I need here is a True/False. It doesnt have to be an exact
match just as long as it matches the FamilyName.
<xsl:template match="SplitNameList">
<xsl:variable name="test">
<xsl:for-each select="SplitName/FamilyName">
<xsl:value-of select="boolean(/XML/FulNameList/FullName[contains(.,
current())])"/>
</xsl:for-each>
</xsl:variable>
<xsl:if test="contains($test, 'true')">..</xsl:if>
</xsl:template>
This will return true if the FamilyName is the same as someones first
name, or say some substring of the surname.
Guessing the requirements, I think would want to tokenize the FullName
and then compare the FamilyName to the last item... but cant be sure.
--
======================================================================
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
======================================================================
|
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
RSS 2.0 |
|
Atom 0.3 |
|
|