XQuery有一组用于日期转换的有用函数.但是如何将"今天"和"昨天"等相关日期转换为实际日期?
例如,"今天,17:33"应转换为"2012-05-30","昨天,22:13"应转换为"2012-05-29".
让我们考虑一个示例代码
declare function local:topic(){
let $forumUrl := "http://www.abc.com"
for $topic in $rootNode//h:td[@class="alt1Active"]//h:a
return
<page>{concat($forumUrl, $topic/@href, '')}</page>
};
declare function local:thread(){
let $forumUrl := "http://www.abc.com"
for $thread in $rootNode//h:td[@class="alt2"]//h:a
return
<thread>{concat(forumUrl, $thread/@href, '')}</thread>
};
Run Code Online (Sandbox Code Playgroud)
我可以在此代码中传递任何参数,而不是重复"$ forumUrl".如果可能,请帮助我.
我有一个类似的 url-pattern "http://www.asdf.com/pages=1",现在我想为这个 url-pattern 操作 for 循环高达 1547 即,( "http://www.asdf.com/pages=1547")
让我们考虑一下这个清单:
x = ['a', 'b', 'c', 'c', 'a', 'd', 'z', 'z']
Run Code Online (Sandbox Code Playgroud)
我想删除这些重复值list-x,并希望结果如下:
y = ['a', 'b', 'c', 'd', 'z']
Run Code Online (Sandbox Code Playgroud) 让我们考虑一个例子,a ='red table jet blue ghost hind'.现在我想要我作为b = ['red','table','jet','blue','ghost','hind'].在python中我们可以使用列表理解,但在Xquery中有没有像"List Comprehension"这样的方法?