[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: how to create variable by comparing two variables
> On 14 Oct 2018, at 21:16, Dave Lang emaildavelang@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > > I think I did a poor job of explaining what I'm trying to do. > > I have two lists of jpg names: $jpg_few and $jpg_many. > > I know that there are jpg names in $jpg_many that are not in jpg_few, but that's okay, I'm not interested in them. > > I'm trying to find what jpg names are in $jpg_few that are NOT in $jpg_many. > > I thought I had tokenized $jpg_few and $jpg_many when I created them. > > When I try to create a new variable by using a "not" expression with $jpg_few and $jpg_many, I get an error message re: "A sequence of more than one item is not allowed as the first argument of fn:tokenize()". That error can only come from an expression that calls tokenize(). It's therefore clearly not your declaration of jpgs_in_xml_not_directories that's at fault. > > > I tried doing string-join to $jpg_few and $jpg_many before putting them in the expression but that didn't work either. > > Here's the expression I'm trying to use to create a variable that shows which jpg names from $jpg_few are NOT in $jpg_many. > > <xsl:variable name="jpgs_in_xml_not_directories" select="($jpg_few)[not(. = $jpg_many)]"/> > > I think the problem is that I'm trying to do something with $jpg_few and $jpg_many that I can't do because they're strings or something, but this is where I get in over my head. It's a good idea to add a type declaration to your variables, e.g. as="xs:string*". This will help anyone reading your code (including you) to see what you think should be in the value of the variable, and if your assumptions are wrong then it will often lead to more focussed diagnostics. Michael Kay Saxonica
|
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
|