RE: [xsl] Do some elements contain strings from other elements?

Subject: RE: [xsl] Do some elements contain strings from other elements?
From: "W Charlton" <XSLList@xxxxxxxxxx>
Date: Thu, 27 Jan 2011 15:43:10 -0000
Martin,

A boolean() virgin no more, I didn't think xsl1 coped with Boolean(). Thatbs
perfect!

Vielen Dank

William Charlton
The yMonda team
yMonda Limited
w: www.ymonda.net


-----Original Message-----
From: Martin Honnen [mailto:Martin.Honnen@xxxxxx]
Sent: 27 January 2011 15:26
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Do some elements contain strings from other elements?

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 doesnbt 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>

--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread