Revision [1418]

Last edited on 2010-05-17 05:24:47 by DavidLee
Additions:
XML Expressions are expressions that construct or return XML [[http://www.w3.org/TR/xpath-datamodel/ XDM]] values including sequences.
For technical specifications of XQuery see [[http://www.w3.org/TR/xquery/ XQuery 1.0: An XML Query Language]]
XQuery 1.0 supports all the XQuery 1.0 and XPath 2.0 functions. See [[http://www.w3.org/TR/xpath-functions/ XQuery 1.0 and XPath 2.0 Functions and Operators]]
Deletions:
XML Expressions are expressions that construct or return XML Infoset values including sequences.


Revision [1174]

Edited on 2010-02-05 14:59:51 by DavidLee

No Differences

Revision [1173]

Edited on 2010-02-05 14:58:29 by DavidLee
Additions:
xquery -q 'declare variable $A external; $A/foo' -n -v A $A
Deletions:
xquery -q '$A/foo' -n -v A $A


Revision [1172]

Edited on 2010-02-05 14:58:07 by DavidLee
Additions:
For example to only pass in the A variable and use the same expression as above
xquery -q '$A/foo' -n -v A $A


Revision [1171]

Edited on 2010-02-05 14:56:53 by DavidLee
Additions:
The generated xquery script for <[ $A/foo ]> looks like
$A/foo
Deletions:
The generated xquery script looks like
[ user supplied xquery text ]


Revision [1170]

Edited on 2010-02-05 14:55:49 by DavidLee
Additions:
===Parameters and Variables===
Positional parameters ($1 ... $N) and all environment variables with the XEXPR flag set are imported automatically.
Positional parameters are imported as variables named $_1 , $_2 ...
Environment variables are imported as their own name e,g $PATH, $TMPDIR
By default only variables assigned within xmlsh inherit the XEXPR flag. The intent is to avoid polluting the global namespace of the xquery expression, and to avoid unnecessary overhead.
The xml namespace is also predeclared and mapped to the XML extension functions.
Additionally all in scope namespaces are predeclared.
This is implemented by prepending a set of XQuery statements to every invocation of <[ ]>
For example suppose the environment contains the variables A and B with the XEXPR flag, and 2 positional parameters.
The generated xquery script looks like
%%(xquery)
declare namespace xmlsh="http://www.xmlsh.org/extfuncs";
[ additional in-scope namespace declarations ]
declare variable $A external ;
declare variable $B external ;
declare variable $_1 external ;
declare variable $_2 external ;
[ user supplied xquery text ]
The benefit of this is that shell variables, parameters, and namespaces are pre-declared with no additional syntax necessary.
However a side effect is that you cannot declare additional namespaces explicitly, or import modules, and there is some overhead
declaring and assigning variables which you may not use.
To have finer control over xquery execution use the [[CommandXQuery xquery]] command.


Revision [1169]

Edited on 2010-02-05 14:41:02 by DavidLee
Additions:
----
[[CoreSyntax]]


Revision [222]

Edited on 2008-06-03 06:38:12 by DavidLee
Additions:
Entire XML documents stored in files can be read into variables using the [[CommandXread xread]] command.
Deletions:
Entire XML documents stored in files can be read into variables using the [[CommandsXread xread]] command.


Revision [221]

Edited on 2008-06-03 06:37:51 by DavidLee
Additions:
====Reading XML Documents====
Entire XML documents stored in files can be read into variables using the [[CommandsXread xread]] command.
Read an xml docment into variable a
xread a < file.xml


Revision [220]

Edited on 2008-06-03 06:36:38 by DavidLee
Additions:
=====XML Process substition=====
Any command that produces an XML document (but not sequences > 1 value) can be evaulated using the $<( command )> syntax.
$ files=$<(xls)>


Revision [219]

Edited on 2008-06-03 06:34:29 by DavidLee
Additions:
XML Expressions, like String expressions have access to environment variables.
$ A=string
$ B=<[<node/>]>
$ echo <[<element attr="{$A}">{$B}</element>]>
<element attr="string">
<node/>
</element>


Revision [218]

The oldest known version of this page was created on 2008-06-03 06:32:11 by DavidLee
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki