Revision [219]

This is an old revision of XmlExpressions made by DavidLee on 2008-06-03 06:34:29.

 

XML Expressions

XML Expressions are expressions that construct or return XML Infoset values including sequences.
These expressions retain an internal parsed representation wherever possible, including when assigned to variables or passed
as arguments to builtin or internal commands.

XML Construction

XML Construction is introduced by using the <[ ]> syntax.
For example, to construct a single xsd:integer value
<[1]>


To construct a sequence of integer,string, and XML node
<[1,"hi there",<foo>bar</foo>]>


XQuery expressions

XML Construction is implemented by using XQuery, so any XQuery expression is valid in an XML constructor expression.
For example FLWOR expressions are supported
<[  
  for $d in 1 to 10 
  let $n := <int>{$d}</int>
  return $n
]>

To see this in action, you can assign this to a variable and echo it.
$ a=<[  
  for $d in 1 to 10 
  let $n := <int>{$d}</int>
  return $n
]>
$ echo $a
<int>1</int> <int>2</int> <int>3</int> <int>4</int> <int>5</int> <int>6</int>
<int>7</int> <int>8</int> <int>9</int> <int>10</int>


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>





There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki