[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Problem matching part of a string

Subject: RE: Problem matching part of a string
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 2 Jun 2005 21:43:37 +0100
morrison meat pies
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:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.