diff options
author | axis <qt-info@nokia.com> | 2009-04-24 11:34:15 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-04-24 11:34:15 (GMT) |
commit | 8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76 (patch) | |
tree | a17e1a767a89542ab59907462206d7dcf2e504b2 /doc/src/snippets/patternist | |
download | Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.zip Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.tar.gz Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.tar.bz2 |
Long live Qt for S60!
Diffstat (limited to 'doc/src/snippets/patternist')
56 files changed, 231 insertions, 0 deletions
diff --git a/doc/src/snippets/patternist/anyHTMLElement.xq b/doc/src/snippets/patternist/anyHTMLElement.xq new file mode 100644 index 0000000..9f5ee12 --- /dev/null +++ b/doc/src/snippets/patternist/anyHTMLElement.xq @@ -0,0 +1 @@ +doc('data.xml')/*:body diff --git a/doc/src/snippets/patternist/anyXLinkAttribute.xq b/doc/src/snippets/patternist/anyXLinkAttribute.xq new file mode 100644 index 0000000..059bcc0 --- /dev/null +++ b/doc/src/snippets/patternist/anyXLinkAttribute.xq @@ -0,0 +1,2 @@ +declare namespace xlink = "http://www.w3.org/1999/xlink"; +doc('image.svg')//@xlink:* diff --git a/doc/src/snippets/patternist/bracesIncluded.xq b/doc/src/snippets/patternist/bracesIncluded.xq new file mode 100644 index 0000000..3961c28 --- /dev/null +++ b/doc/src/snippets/patternist/bracesIncluded.xq @@ -0,0 +1 @@ +<e>{sum((1, 2, 3))}</e> diff --git a/doc/src/snippets/patternist/bracesIncludedResult.xml b/doc/src/snippets/patternist/bracesIncludedResult.xml new file mode 100644 index 0000000..0004c71 --- /dev/null +++ b/doc/src/snippets/patternist/bracesIncludedResult.xml @@ -0,0 +1 @@ +<e>6</e> diff --git a/doc/src/snippets/patternist/bracesOmitted.xq b/doc/src/snippets/patternist/bracesOmitted.xq new file mode 100644 index 0000000..ffbadd0 --- /dev/null +++ b/doc/src/snippets/patternist/bracesOmitted.xq @@ -0,0 +1 @@ +<e>sum({(1, 2, 3)})</e> diff --git a/doc/src/snippets/patternist/bracesOmittedResult.xml b/doc/src/snippets/patternist/bracesOmittedResult.xml new file mode 100644 index 0000000..744fb8f --- /dev/null +++ b/doc/src/snippets/patternist/bracesOmittedResult.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<e>sum(1 2 3)</e>
\ No newline at end of file diff --git a/doc/src/snippets/patternist/computedTreeFragment.xq b/doc/src/snippets/patternist/computedTreeFragment.xq new file mode 100644 index 0000000..c5b93ad --- /dev/null +++ b/doc/src/snippets/patternist/computedTreeFragment.xq @@ -0,0 +1,14 @@ +declare default element namespace "http://example.com/Namespace"; +declare variable $documentElementName := "doc"; + +element {$documentElementName} +{ + attribute xml:base {"http://example.com/"}, + element anotherElement + { + comment {" a comment "}, + processing-instruction target {"data"}, + element anotherElement {()}, + text {"some text"} + } +} diff --git a/doc/src/snippets/patternist/copyAttribute.xq b/doc/src/snippets/patternist/copyAttribute.xq new file mode 100644 index 0000000..40e4494 --- /dev/null +++ b/doc/src/snippets/patternist/copyAttribute.xq @@ -0,0 +1,9 @@ +<html> + <body> + <p> + { + doc('feed.rss')/rss/@version + } + </p> + </body> +</html> diff --git a/doc/src/snippets/patternist/copyID.xq b/doc/src/snippets/patternist/copyID.xq new file mode 100644 index 0000000..2409caf --- /dev/null +++ b/doc/src/snippets/patternist/copyID.xq @@ -0,0 +1,3 @@ +(: Copy the value of xml:id attribute from other.html. This is a comment by the way! :) +<html xmlns="http://www.w3.org/1999/xhtml/" + xml:id="{doc("other.html")/html/@xml:id}"/> diff --git a/doc/src/snippets/patternist/directTreeFragment.xq b/doc/src/snippets/patternist/directTreeFragment.xq new file mode 100644 index 0000000..96bc963 --- /dev/null +++ b/doc/src/snippets/patternist/directTreeFragment.xq @@ -0,0 +1,7 @@ +<doc xmlns="http://example.com/Namespace" xml:base="http://example.com/"> + + <!-- a comment --> + <?target data?> + <anotherElement/> + some text +</doc> diff --git a/doc/src/snippets/patternist/doc.txt b/doc/src/snippets/patternist/doc.txt new file mode 100644 index 0000000..d30b057 --- /dev/null +++ b/doc/src/snippets/patternist/doc.txt @@ -0,0 +1,35 @@ +<doc> + <p> + <span>1</span> + <span>2</span> + </p> + <p> + <span>3</span> + <span>4</span> + </p> + <p> + <span>5</span> + <span>6</span> + </p> + <p> + <span>7</span> + <span>8</span> + </p> + <p> + <span>9</span> + <span>a</span> + </p> + <p> + <span>b</span> + <span>c</span> + </p> + <p> + <span>d</span> + <span>e</span> + </p> + <p> + <span>f</span> + <span>0</span> + </p> +</doc> + diff --git a/doc/src/snippets/patternist/docPlainHTML.xq b/doc/src/snippets/patternist/docPlainHTML.xq new file mode 100644 index 0000000..622bec8 --- /dev/null +++ b/doc/src/snippets/patternist/docPlainHTML.xq @@ -0,0 +1 @@ +doc("myPlainHTML.html")/body diff --git a/doc/src/snippets/patternist/docPlainHTML2.xq b/doc/src/snippets/patternist/docPlainHTML2.xq new file mode 100644 index 0000000..5e7fbae --- /dev/null +++ b/doc/src/snippets/patternist/docPlainHTML2.xq @@ -0,0 +1 @@ +doc("myPlainHTML.html")/html/body diff --git a/doc/src/snippets/patternist/embedDataInXHTML.xq b/doc/src/snippets/patternist/embedDataInXHTML.xq new file mode 100644 index 0000000..b513922 --- /dev/null +++ b/doc/src/snippets/patternist/embedDataInXHTML.xq @@ -0,0 +1,10 @@ +declare default element namespace "http://www.w3.org/1999/xhtml"; +<html> + <body> + { + for $i in doc("testResult.xml")/tests/test[@status = "failure"] + order by $i/@name + return <p>{$i/@name}</p> + } + </body> +</html> diff --git a/doc/src/snippets/patternist/embedDataInXHTML2.xq b/doc/src/snippets/patternist/embedDataInXHTML2.xq new file mode 100644 index 0000000..754ddba --- /dev/null +++ b/doc/src/snippets/patternist/embedDataInXHTML2.xq @@ -0,0 +1,10 @@ +declare namespace x = "http://www.w3.org/1998/xhtml"; +<x:html> + <x:body> + { + for $i in doc("testResult.xml")/tests/test[@status = "failure"] + order by $i/@name + return <x:p>{$i/@name}</x:p> + } + </x:body> +</x:html> diff --git a/doc/src/snippets/patternist/emptyParagraphs.xq b/doc/src/snippets/patternist/emptyParagraphs.xq new file mode 100644 index 0000000..6024d28 --- /dev/null +++ b/doc/src/snippets/patternist/emptyParagraphs.xq @@ -0,0 +1 @@ +doc('index.html')//p[string-length(.) = 0] diff --git a/doc/src/snippets/patternist/escapeCurlyBraces.xq b/doc/src/snippets/patternist/escapeCurlyBraces.xq new file mode 100644 index 0000000..669e7c1 --- /dev/null +++ b/doc/src/snippets/patternist/escapeCurlyBraces.xq @@ -0,0 +1,4 @@ +<doc> + This is one left followed by one right curly brace: {{ }} + Here they are again, but with character references: { } +</doc> diff --git a/doc/src/snippets/patternist/escapeStringLiterals.xml b/doc/src/snippets/patternist/escapeStringLiterals.xml new file mode 100644 index 0000000..425ccb0 --- /dev/null +++ b/doc/src/snippets/patternist/escapeStringLiterals.xml @@ -0,0 +1,2 @@ +<p>"I hate quotations" -- Ralph Waldo Emerson" + '"I hate quotations"" -- Ralph Waldo Emerson"', appeared above</p>
\ No newline at end of file diff --git a/doc/src/snippets/patternist/escapeStringLiterals.xq b/doc/src/snippets/patternist/escapeStringLiterals.xq new file mode 100644 index 0000000..4a6054b --- /dev/null +++ b/doc/src/snippets/patternist/escapeStringLiterals.xq @@ -0,0 +1,7 @@ +<p> +{ + """I hate quotations"" -- Ralph Waldo Emerson""", + "
", + '''"I hate quotations"" -- Ralph Waldo Emerson"'', appeared above' +} +</p> diff --git a/doc/src/snippets/patternist/expressionInsideAttribute.xq b/doc/src/snippets/patternist/expressionInsideAttribute.xq new file mode 100644 index 0000000..97f46b1 --- /dev/null +++ b/doc/src/snippets/patternist/expressionInsideAttribute.xq @@ -0,0 +1,2 @@ +declare variable $additionalClass := "example"; +<p class="important {$additionalClass} obsolete"/> diff --git a/doc/src/snippets/patternist/filterOnPath.xq b/doc/src/snippets/patternist/filterOnPath.xq new file mode 100644 index 0000000..d23dfe8 --- /dev/null +++ b/doc/src/snippets/patternist/filterOnPath.xq @@ -0,0 +1,2 @@ +let $doc := doc('doc.txt') +return ($doc/doc/p/span)[1] diff --git a/doc/src/snippets/patternist/filterOnStep.xq b/doc/src/snippets/patternist/filterOnStep.xq new file mode 100644 index 0000000..46b77fa --- /dev/null +++ b/doc/src/snippets/patternist/filterOnStep.xq @@ -0,0 +1,2 @@ +let $doc := doc('doc.txt') +return $doc/doc/p/span[1]
\ No newline at end of file diff --git a/doc/src/snippets/patternist/firstParagraph.xq b/doc/src/snippets/patternist/firstParagraph.xq new file mode 100644 index 0000000..db5e2c7 --- /dev/null +++ b/doc/src/snippets/patternist/firstParagraph.xq @@ -0,0 +1 @@ +doc("index.html")/html/body/p[@xml:id = "thatSpecialOne"] diff --git a/doc/src/snippets/patternist/fnStringOnAttribute.xq b/doc/src/snippets/patternist/fnStringOnAttribute.xq new file mode 100644 index 0000000..b26e9f2 --- /dev/null +++ b/doc/src/snippets/patternist/fnStringOnAttribute.xq @@ -0,0 +1,9 @@ +<html> + <body> + <p> + { + string(doc('feed.rss')/rss/@version) + } + </p> + </body> +</html> diff --git a/doc/src/snippets/patternist/forClause.xq b/doc/src/snippets/patternist/forClause.xq new file mode 100644 index 0000000..a412dca --- /dev/null +++ b/doc/src/snippets/patternist/forClause.xq @@ -0,0 +1,3 @@ +for $i in(reverse(1 to 10)), + $d in xs:integer(doc("numbers.xml")/numbers/number) +return ($i + $d) diff --git a/doc/src/snippets/patternist/forClause2.xq b/doc/src/snippets/patternist/forClause2.xq new file mode 100644 index 0000000..4fa505d --- /dev/null +++ b/doc/src/snippets/patternist/forClause2.xq @@ -0,0 +1,3 @@ +for $i in(reverse(1 to 10)), + $d in xs:integer(doc("numbers.xml")/numbers/number) +return $i + $d diff --git a/doc/src/snippets/patternist/forClauseOnFeed.xq b/doc/src/snippets/patternist/forClauseOnFeed.xq new file mode 100644 index 0000000..9ec3339 --- /dev/null +++ b/doc/src/snippets/patternist/forClauseOnFeed.xq @@ -0,0 +1,6 @@ +for $item in doc('feed.rss')//item +return <p> + { + $item/description/node() + } + </p> diff --git a/doc/src/snippets/patternist/indented.xml b/doc/src/snippets/patternist/indented.xml new file mode 100644 index 0000000..a312c63 --- /dev/null +++ b/doc/src/snippets/patternist/indented.xml @@ -0,0 +1,5 @@ +<a> + <b/> + <c/> + <p>Some Text</p> +</a> diff --git a/doc/src/snippets/patternist/introAcneRemover.xq b/doc/src/snippets/patternist/introAcneRemover.xq new file mode 100644 index 0000000..4e6ee80 --- /dev/null +++ b/doc/src/snippets/patternist/introAcneRemover.xq @@ -0,0 +1,8 @@ +<result> + <para>The following skin care products have shipped, ordered by shipping date(oldest first):</para> + { + for $i in doc("myOrders.xml")/orders/order[@product = "Acme Skin Care"] + order by xs:date($i/@shippingDate) descending + return $i + } +</result> diff --git a/doc/src/snippets/patternist/introExample2.xq b/doc/src/snippets/patternist/introExample2.xq new file mode 100644 index 0000000..411cc17 --- /dev/null +++ b/doc/src/snippets/patternist/introExample2.xq @@ -0,0 +1,5 @@ +<bibliography> +{ + doc($file)/bib/book[publisher = $publisher and @year > $year]/<book year="{@year}">{title}</book> +} +</bibliography> diff --git a/doc/src/snippets/patternist/introFileHierarchy.xml b/doc/src/snippets/patternist/introFileHierarchy.xml new file mode 100644 index 0000000..cfa6151 --- /dev/null +++ b/doc/src/snippets/patternist/introFileHierarchy.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<directory name="home"> + + <file name="myNote.txt" mimetype="text/plain" size="8" extension="txt" uri="file:///home/frans/myNote.txt"> + <content asBase64Binary="TXkgTm90ZSE=" asStringFromUTF-8="My Note!"/> + </file> + + <directory name="src"> + ... + </directory> + + ... + +</directory> diff --git a/doc/src/snippets/patternist/introNavigateFS.xq b/doc/src/snippets/patternist/introNavigateFS.xq new file mode 100644 index 0000000..1f5a3a7 --- /dev/null +++ b/doc/src/snippets/patternist/introNavigateFS.xq @@ -0,0 +1,12 @@ +declare variable $myRoot := <e/>; (: This line is a dummy and shouldn't appear in the documentation. :) +<html> + <body> + { + $myRoot//file[@mimetype = 'text/xml' or @mimetype = 'application/xml'] + / + (if(doc-available(@uri)) + then () + else <p>Failed to parse file {@uri}.</p>) + } + </body> +</html> diff --git a/doc/src/snippets/patternist/introductionExample.xq b/doc/src/snippets/patternist/introductionExample.xq new file mode 100644 index 0000000..1a309dd --- /dev/null +++ b/doc/src/snippets/patternist/introductionExample.xq @@ -0,0 +1,3 @@ +<bibliography> +{doc("library.xml")/bib/book[publisher="Addison-Wesley" and @year>1991]/<book year="{@year}">{title}</book>} +</bibliography> diff --git a/doc/src/snippets/patternist/invalidLetOrderBy.xq b/doc/src/snippets/patternist/invalidLetOrderBy.xq new file mode 100644 index 0000000..d65f240 --- /dev/null +++ b/doc/src/snippets/patternist/invalidLetOrderBy.xq @@ -0,0 +1,3 @@ +let $i := (2, 3, 1) +order by $i[1] +return $i diff --git a/doc/src/snippets/patternist/items.xq b/doc/src/snippets/patternist/items.xq new file mode 100644 index 0000000..0b46ec1 --- /dev/null +++ b/doc/src/snippets/patternist/items.xq @@ -0,0 +1,5 @@ +<aNode/>, +xs:base64Binary("FFFF"), +current-date(), +3e3, (: A floating point value :) +attribute {"name"} {()} diff --git a/doc/src/snippets/patternist/letOrderBy.xq b/doc/src/snippets/patternist/letOrderBy.xq new file mode 100644 index 0000000..f4106d2 --- /dev/null +++ b/doc/src/snippets/patternist/letOrderBy.xq @@ -0,0 +1,4 @@ +for $a in (8, -4, 2) +let $b := ($a * -1, $a) +order by $a +return $b diff --git a/doc/src/snippets/patternist/literalsAndOperators.xq b/doc/src/snippets/patternist/literalsAndOperators.xq new file mode 100644 index 0000000..ec4af33 --- /dev/null +++ b/doc/src/snippets/patternist/literalsAndOperators.xq @@ -0,0 +1,2 @@ +declare variable $date := fn:current-date(); (: This line should not be part of the example. It exists in order to make the query valid. :) +fn:current-date() - $date > xs:dayTimeDuration("P365D") diff --git a/doc/src/snippets/patternist/mobeyDick.xml b/doc/src/snippets/patternist/mobeyDick.xml new file mode 100644 index 0000000..32d0b6c --- /dev/null +++ b/doc/src/snippets/patternist/mobeyDick.xml @@ -0,0 +1,4 @@ +<book xmlns:dc='http://purl.org/dc/elements/1.1' + xmlns='http://example.com/MyDefault'> + <dc:title>Mobey Dick</dc:title> ... +</book> diff --git a/doc/src/snippets/patternist/nextLastParagraph.xq b/doc/src/snippets/patternist/nextLastParagraph.xq new file mode 100644 index 0000000..9424f79 --- /dev/null +++ b/doc/src/snippets/patternist/nextLastParagraph.xq @@ -0,0 +1 @@ +doc('index.html')//p[last() - 1] diff --git a/doc/src/snippets/patternist/nodeConstructorsAreExpressions.xq b/doc/src/snippets/patternist/nodeConstructorsAreExpressions.xq new file mode 100644 index 0000000..ce36e84 --- /dev/null +++ b/doc/src/snippets/patternist/nodeConstructorsAreExpressions.xq @@ -0,0 +1,4 @@ +let $docURI := 'maybeNotWellformed.xml' +return if(doc-available($docURI)) + then doc($docURI)//p/<para>{./node()}</para> + else <para>Failed to load {$docURI}</para> diff --git a/doc/src/snippets/patternist/nodeConstructorsInPaths.xq b/doc/src/snippets/patternist/nodeConstructorsInPaths.xq new file mode 100644 index 0000000..beb294f --- /dev/null +++ b/doc/src/snippets/patternist/nodeConstructorsInPaths.xq @@ -0,0 +1 @@ +doc('feed.rss')//item/<p>{description/node()}</p> diff --git a/doc/src/snippets/patternist/nodeTestChildElement.xq b/doc/src/snippets/patternist/nodeTestChildElement.xq new file mode 100644 index 0000000..7aa7b34 --- /dev/null +++ b/doc/src/snippets/patternist/nodeTestChildElement.xq @@ -0,0 +1 @@ +doc('index.html')/descendant-or-self::element(p)/child::element(span) diff --git a/doc/src/snippets/patternist/notIndented.xml b/doc/src/snippets/patternist/notIndented.xml new file mode 100644 index 0000000..b3321f2 --- /dev/null +++ b/doc/src/snippets/patternist/notIndented.xml @@ -0,0 +1 @@ +<a><b/><c/><p>Some Text</p></a> diff --git a/doc/src/snippets/patternist/oneElementConstructor.xq b/doc/src/snippets/patternist/oneElementConstructor.xq new file mode 100644 index 0000000..b7eb615 --- /dev/null +++ b/doc/src/snippets/patternist/oneElementConstructor.xq @@ -0,0 +1 @@ +<myElement/> diff --git a/doc/src/snippets/patternist/paragraphsExceptTheFiveFirst.xq b/doc/src/snippets/patternist/paragraphsExceptTheFiveFirst.xq new file mode 100644 index 0000000..16438d1 --- /dev/null +++ b/doc/src/snippets/patternist/paragraphsExceptTheFiveFirst.xq @@ -0,0 +1 @@ +doc('index.html')//p[position() > 5] diff --git a/doc/src/snippets/patternist/paragraphsWithTables.xq b/doc/src/snippets/patternist/paragraphsWithTables.xq new file mode 100644 index 0000000..dbb9fcf --- /dev/null +++ b/doc/src/snippets/patternist/paragraphsWithTables.xq @@ -0,0 +1 @@ +doc('index.html')/html/body/p[table] diff --git a/doc/src/snippets/patternist/pathAB.xq b/doc/src/snippets/patternist/pathAB.xq new file mode 100644 index 0000000..26fd1e5 --- /dev/null +++ b/doc/src/snippets/patternist/pathAB.xq @@ -0,0 +1 @@ +doc('index.html')//p/span diff --git a/doc/src/snippets/patternist/pathsAllParagraphs.xq b/doc/src/snippets/patternist/pathsAllParagraphs.xq new file mode 100644 index 0000000..ba47900 --- /dev/null +++ b/doc/src/snippets/patternist/pathsAllParagraphs.xq @@ -0,0 +1 @@ +doc('index.html')//p diff --git a/doc/src/snippets/patternist/simpleHTML.xq b/doc/src/snippets/patternist/simpleHTML.xq new file mode 100644 index 0000000..93ac31e --- /dev/null +++ b/doc/src/snippets/patternist/simpleHTML.xq @@ -0,0 +1 @@ +doc("index.html")/html/body/p[@class="example"] diff --git a/doc/src/snippets/patternist/simpleXHTML.xq b/doc/src/snippets/patternist/simpleXHTML.xq new file mode 100644 index 0000000..fda5371 --- /dev/null +++ b/doc/src/snippets/patternist/simpleXHTML.xq @@ -0,0 +1,2 @@ +declare namespace x = "http://www.w3.org/1999/xhtml/"; +doc("index.html")/x:html/x:body/x:p[@class="example"] diff --git a/doc/src/snippets/patternist/svgDocumentElement.xml b/doc/src/snippets/patternist/svgDocumentElement.xml new file mode 100644 index 0000000..0c7be4e --- /dev/null +++ b/doc/src/snippets/patternist/svgDocumentElement.xml @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg"/> diff --git a/doc/src/snippets/patternist/tablesInParagraphs.xq b/doc/src/snippets/patternist/tablesInParagraphs.xq new file mode 100644 index 0000000..fc92cf0 --- /dev/null +++ b/doc/src/snippets/patternist/tablesInParagraphs.xq @@ -0,0 +1 @@ +doc('index.html')/html/body/p/table diff --git a/doc/src/snippets/patternist/twoSVGElements.xq b/doc/src/snippets/patternist/twoSVGElements.xq new file mode 100644 index 0000000..ab4fe35 --- /dev/null +++ b/doc/src/snippets/patternist/twoSVGElements.xq @@ -0,0 +1,5 @@ +declare namespace s = "http://www.w3.org/2000/svg"; +declare default element namespace "http://www.w3.org/2000/svg"; +let $doc := doc('image.svg') +return ($doc/svg, + $doc/s:svg) diff --git a/doc/src/snippets/patternist/xmlStylesheet.xq b/doc/src/snippets/patternist/xmlStylesheet.xq new file mode 100644 index 0000000..9e02208 --- /dev/null +++ b/doc/src/snippets/patternist/xmlStylesheet.xq @@ -0,0 +1 @@ +<?xml-stylesheet type="test/xsl" href="formatter.xsl"?> diff --git a/doc/src/snippets/patternist/xsBooleanTrue.xq b/doc/src/snippets/patternist/xsBooleanTrue.xq new file mode 100644 index 0000000..897a99e --- /dev/null +++ b/doc/src/snippets/patternist/xsBooleanTrue.xq @@ -0,0 +1 @@ +xs:boolean("true") diff --git a/doc/src/snippets/patternist/xsvgDocumentElement.xml b/doc/src/snippets/patternist/xsvgDocumentElement.xml new file mode 100644 index 0000000..fb6a236 --- /dev/null +++ b/doc/src/snippets/patternist/xsvgDocumentElement.xml @@ -0,0 +1 @@ +<x:svg xmlns:x="http://www.w3.org/2000/svg"/> |