| 1 | <h2>Comments</h2> |
| 2 | <pre><code>(::) |
| 3 | (: Comment :) |
| 4 | (: Multi-line |
| 5 | comment :) |
| 6 | (:~ |
| 7 | : The <b>functx:substring-after-last</b> function returns the part |
| 8 | : of <b>$string</b> that appears after the last occurrence of |
| 9 | : <b>$delim</b>. If <b>$string</b> does not contain |
| 10 | : <b>$delim</b>, the entire string is returned. |
| 11 | : |
| 12 | : @param $string the string to substring |
| 13 | : @param $delim the delimiter |
| 14 | : @return the substring |
| 15 | :)</code></pre> |
| 16 | |
| 17 | <h2>Variables</h2> |
| 18 | <pre><code>$myProduct |
| 19 | $foo-bar |
| 20 | $strings:LetterA</code></pre> |
| 21 | |
| 22 | <h2>Functions</h2> |
| 23 | <pre><code>document-node(schema-element(catalog)) |
| 24 | strings:trim($arg as xs:string?) |
| 25 | false()</code></pre> |
| 26 | |
| 27 | <h2>Keywords</h2> |
| 28 | <pre><code>xquery version "1.0"; |
| 29 | declare default element namespace "http://datypic.com/cat"; |
| 30 | declare boundary-space preserve; |
| 31 | declare default collation "http://datypic.com/collation/custom";</code></pre> |
| 32 | |
| 33 | <h2>Types</h2> |
| 34 | <pre><code>xs:anyAtomicType |
| 35 | element |
| 36 | xs:double</code></pre> |
| 37 | |
| 38 | <h2>Full example</h2> |
| 39 | <pre><code><report xmlns="http://datypic.com/report" |
| 40 | xmlns:cat="http://datypic.com/cat" |
| 41 | xmlns:prod="http://datypic.com/prod"> { |
| 42 | for $product in doc("prod_ns.xml")/prod:product |
| 43 | return <lineItem> |
| 44 | {$product/prod:number} |
| 45 | {$product/prod:name} |
| 46 | </lineItem> |
| 47 | } </report></code></pre> |