XQuery Tutorial
Selected Reading
- XQuery - Discussion
- XQuery - Useful Resources
- XQuery - Quick Guide
- XQuery - Custom Functions
- XQuery - If Then Else
- XQuery - Regular Expressions
- XQuery - Date Functions
- XQuery - String functions
- XQuery - Sequence Functions
- XQuery - Sequences
- XQuery - XPath
- XQuery - HTML Format
- XQuery - FLWOR
- XQuery - First Application
- XQuery - Environment Setup
- XQuery - Overview
- XQuery - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
XQuery - Sequences
XQuery - Sequences
持有量是订购的物品集,物品可以类似或不同类型。
Creating a Sequence
产生频率时使用括号,在引文中加插或翻版和编号。 也可以将XML要素用作顺序的项目。
XQuery Expression
let $items := ( orange , <apple/>, <fruit type="juicy"/>, <vehicle type="car">sentro</vehicle>, 1,2,3, a , b ,"abc") let $count := count($items) return <result> <count>{$count}</count> <items> { for $item in $items return <item>{$item}</item> } </items> </result>
Output
<result> <count>10</count> <items> <item>orange</item> <item> <apple/> </item> <item> <fruit type="juicy"/> </item> <item> <vehicle type="car">Sentro</vehicle> </item> <item>1</item> <item>2</item> <item>3</item> <item>a</item> <item>b</item> <item>abc</item> </items> </result>
Viewing the Items of a Sequence
序列项目可采用指数或数值,按顺序排列。 以上例子将顺序排列的项目逐个。 让我们看到其他两种行动方式。
XQuery Expression (Index)
let $items := (1,2,3,4,5,6) let $count := count($items) return <result> <count>{$count}</count> <items> { for $item in $items[2] return <item>{$item}</item> } </items> </result>
Output
<result> <count>6</count> <items> <item>2</item> </items> </result>
XQuery Expression (Value)
let $items := (1,2,3,4,5,6) let $count := count($items) return <result> <count>{$count}</count> <items> { for $item in $items[. = (1,2,3)] return <item>{$item}</item> } </items> </result>
Output
<result> <count>6</count> <items> <item>1</item> <item>2</item> <item>3</item> </items> </result>Advertisements