[MarkLogic Dev General] How to cast a sequence as a string?

Jim.Stock at empolis.com Jim.Stock at empolis.com
Tue Dec 18 00:43:21 PST 2007


Hi,

 

I have a sequence of integers that I iterate through to get a numeric
equivalent from a string based on the corresponding position.

 

e.g.

 

let $string := "ABC"

let $data := ("1", "3", "1", "2")

for $i in $data

return (

      (: get the substring that is 1 character long from $string at
position $i :)

fn:substring($string, $i, 1)

)

 

I'm using this to build part of a URL where no spaces are allowed.

 

So what I would like is the following string:

 

"ACAB"

 

But what I'm getting is a sequence

 

A C A B

 

How can I cast a sequence to a string?

 

If I try string-join or similar I get an "invalid coercion" error.

 

Thanks in advance for what I'm sure is a simple thing to solve,

Jim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xqzone.marklogic.com/pipermail/general/attachments/20071218/ff176a4f/attachment.html


More information about the General mailing list