RE: [xsl] Problem matching part of a string

Subject: RE: [xsl] Problem matching part of a string
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 2 Jun 2005 21:43:37 +0100
I think the logic you are trying to describe is

<xsl:attribute name="claimable"
  select="some $v in $docA/vendors/vendor satisfies starts-with($v,
@name)"/>

or if you prefer 1.0 syntax

<xsl:attribute name="claimable">
  <xsl:value-of select="boolean($docA/vendors/vendor[starts-with(.,
current()/@name)])"/>
</xsl:attribute>

That may not perform well, but get it working first and then worry about
speeding it up.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Kent Seegmiller [mailto:hookjaw20@xxxxxxxxxxx] 
> Sent: 02 June 2005 07:24
> To: XSLT
> Subject: [xsl] Problem matching part of a string
> 
> OK here is my problem:
> I have 2 source docs.  Doc 'A' has this:
> <vendors>
>   <vendor>DAN MORRISON MEAT PIES</vendor>
>   <vendor>BOISE CASCADE</vendor>
>   <vendor>CANDY TECH INC</vendor>
>   <vendor>WF</vendor>
> </vendors>
> 
> And Doc 'B' has this:
> 
> ...
> <vendor name="..."/>
> <vendor name="..."/>
> <vendor name="..."/>
> <vendor name="..."/>
> ...
> 
> And I want to create a third xml doc using xslt2.0 that cross 
> references the 
> first part of @name of doc 'B' with the vendor element in doc 
> 'A' and if so, 
> make the claimable att. 'true'. There are some 1300 vendor 
> names in doc 'B' 
> and there are some 100 vendors that begin with 'WF'. So I get 
> this in the 
> third xml.
> 
> ...
> <vendor name="..." claimable="true/false"/>
> <vendor name="..." claimable="true/false"/>
> <vendor name="..." claimable="true/false"/>
> <vendor name="..." claimable="true/false"/>
> ...
> 
> but I am having problems with the substring function.
> 
> -Thanks, KS 

Current Thread