Monday 4 January 2016

Determine the position and content of an item in a string sequence

Issue

We have a sequence of strings and for each item we need the position of the item within the sequence

Resolution

use the following xpath expression

Xquery

let
  $items := tokenize('xslt-tricks.blogspot.co.uk/search/label/xquery','/')
return
  for $i in 1 to count($items) 
  return (
   $i, (: position  :)
   $items[$i]  (: item content :)
  )

No comments:

Post a Comment