xsl-list
[Top] [All Lists]

Re: [xsl] XPath expression to convert a list of (string) integers into a sequence of (genuine) integers

2012-12-26 11:07:10
This can also be used with XPath 3.0:

  map(codepoints-to-string#1, map(xs:integer#1,tokenize(., '\s+')))

and produces:

"T h e   s e c r e t   a g e n t   i s   . . ."


Cheers,
Dimitre

On Wed, Dec 26, 2012 at 5:44 AM, Costello, Roger L. 
<costello(_at_)mitre(_dot_)org> wrote:
Hi Folks,

I want an XPath expression to convert the codepoints in this element

<Numbers>84 104 101 32 115 101 99 114 101 116 32 97 103 101 110 116 32 105 
115 32 46 46 46</Numbers>

into a string.

Here is one way to do it

    codepoints-to-string(for $i in tokenize(., '\s+') return xs:integer($i))

Is there a better XPath expression?

By "better" I mean simpler.

/Roger

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>