- From: Robie, Jonathan <jonathan.robie@emc.com>
- Date: Tue, 29 Sep 2015 20:34:28 +0000
- To: Public Joint XSLT XQuery XPath <public-xsl-query@w3.org>
For anyone following this discussion, here is the syntax we adopted today:
6. ``[ ]``, `{ }`
Here are the examples we discussed for the earlier proposals. I think we chose well.
Jonathan
First a function that returns text:
declare function local:prize-message($a) as xs:string
{
``[Hello `{$a.name}`
You have just won `{$a.value}` dollars!
`{
if ($a.in_ca)
then ``[Well, `{$a.taxed_value}` dollars, after taxes.]``
else ""
}`]``
}
Here's what it looks like if we produce HTML instead of text:
declare function local:prize-message($a) as xs:string
{
``[
<div>
<h1>Hello `{$a.name}`</h1>
<p>You have just won `{$a.value}` dollars!</p>
`{
if ($a.in_ca)
then ``[ <p>Well, `{$a.taxed_value}` dollars, after taxes.</p> ]``
else ""
}`
</div>
]``
}
Here's what it looks like if we produce JSON:
declare function local:prize-message($a) as xs:string
{
``[
{
"greetings" : "Hello!",
"value" : $a.value
`{
if ($a.in_ca)
then
``[,
"taxed_value", `{ $a.taxed_value }`
]``
else ""
}`
}
]``
}
Received on Tuesday, 29 September 2015 20:37:24 UTC