Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

xpath sequence methods and subscripts

19 views
Skip to first unread message

rvj

unread,
Feb 7, 2011, 10:46:28 AM2/7/11
to

1. anyone got an example of how to return the results of a sequence method
such as tokenize ?

<assign var="?alltokens" expr="tokenize('in the beginning') />

2. or how to return the second "token" - some kind of subscript on data??

<assign var="?secondtoken" expr="data(tokenize('in the beginning'),2)
/>


rvj

unread,
Feb 7, 2011, 10:57:17 AM2/7/11
to
I guess it's subsequence !


"rvj" <r...@rolemodels.net> wrote in message
news:0PSdnRqmfthOjs3Q...@mozilla.org...

rvj

unread,
Feb 7, 2011, 11:07:43 AM2/7/11
to
.....is this the correct syntax to return "the"?

<assign var="?secondtoken" expr="subsequence('in','the','beginning'),2)"
/>


"rvj" <r...@rolemodels.net> wrote in message

news:0sqdnW-dv6rAi83Q...@mozilla.org...

rvj

unread,
Feb 7, 2011, 11:29:40 AM2/7/11
to
or

<assign var="?secondtoken" expr="subsequence(tokenize(@phrase),2)"

where @phrase is "in the beginning"

"rvj" <r...@rolemodels.net> wrote in message

news:NJqdnQiz6tBNhc3Q...@mozilla.org...

Martin Honnen

unread,
Feb 8, 2011, 7:33:02 AM2/8/11
to

I am not sure what technology you are trying to use. This is the Mozilla
newsgroup for XML. tokenize is a function supported in XPath and XSLT
2.0 and in XQuery 1.0 but as far as I know Mozilla does only support
XSLT and XPath 1.0 which does not know any sequences.

In XPath 2.0 to access the second item in the sequence $foo is simply
$foo[2]
so
tokenize('in the beginning', ' ')[2]
should give you the string 'the'.


--

Martin Honnen
http://msmvps.com/blogs/martin_honnen/

0 new messages