--- In xpl-dev@y..., Robert A Hopkins <p061949c@p...> wrote:
I was fiddling around with the idea of an xml language and these are
some
ideas I had on what it might look like. Does any of this look at all
like
anything any of you had in mind? (Note resemblance to QBasic.)
<?xml version="1.0" xmlns:xpl="http://www.w3.org/something/or/other/"?
>
<xpl xmlns:xpl="http://www.w3.org/hoopla/about/xpl/">
<!--Declare some constants.-->
<xpl:constant-declaration>
<xpl:constant name="qwerty" type="string">flagrent</xpl:constant>
<xpl:constant name="pi" type="number">3.14168</xpl:constant>
<xpl:constant name="gotAsparagus"
type="boolean">true</xpl:constant>
</xpl:constant-declaration>
<!--Or maybe this way:-->
<!--This is better. The constant is an element which contains a
value.-->
<xpl:constant-declaration>
<qwerty type="string">flagrent</qwerty>
<pi type="number">3.14168</pi>
<gotAsparagus type="boolean">true</gotAsparagus>
</xpl:constant-declaration>
<!--Let's put some values into the variables "rows" & "columns".-->
<xpl:input src="keyboard" type="integer">rows</xpl:input>
<xpl:input src="keyboard" type="integer">columns</xpl:input>
<!--Create a complex type to store coordinates within a grid and a
boolean value representing a light turned on or off.-->
<xpl:dimension>
<!--I'm not entirely happy with "1 to rows" etc.-->
<xpl:dataType name="lights" xpl:dimension-1="1 to rows"
xpl:dimension-2="1 to columns">
<lights>
<xpl:data name="x" type="integer"/>
<xpl:data name="y" type="integer"/>
<xpl:data name="onOff" type="boolean"/>
</lights>
</xpl:dataType>
</xpl:dimension>
<!--Only one general type of loop is needed. Needs an attribute
like
xpl:counter="??"-->
<!--Loops need work.-->
<xpl:loop>
<xpl:exit-before/>
<xpl:exit-loop/>
</xpl:loop>
<!--Let's create a general-purpose conditional form. Is there a
fundamental difference between "if...then" & "select...case"? Why not
use
exactly the same form for all conditional statements.-->
<xpl:input src="keyboard" type="string">tgif</xpl:input>
<!--A string entered from the keyboard is assigned to the variable
"tgif".-->
<xpl:if xpl:argument="tgif" xpl:test="boolean">
<xpl:case>Thursday<isTgif>false</isTgif></xpl:case>
<xpl:case>Saturday<xpl:output xpl:where-to="screen">Too
late!</xpl:output></xpl:case>
<xpl:case>Friday<isTgif>true</isTgif><xpl:output
xpl:where-to="screen">Thangodd!</xpl:output><!--In the last case both
the
isTgif and the xpl:output elments are contained within the xpl:case
element, so both are output when the value of tgif is found to be
"Friday"--></xpl:case>
</xpl:if>
<!--Or this form:-->
<xpl:if xpl:argument="lights{rows.columns}.x">
<xpl:case
xpl:operator="greater-than">75<lights
{rows.columns}.onOff>false</lights{rows.columns}.onOff></xpl:case>
</xpl:if>
<!--Now for an equation:-->
<!--Rather than use the form "area=expression", I think that a
variable
element enclosing or containing a function which returns a value is
better xml.-->
<!--Not particularly easier to read, though.-->
<xpl:input src="keyboard" type="number">radius</xpl:input>
<area>pi * radius ^ 2</area>
<xpl:output xpl:where-to="screen">area</xpl:output>
<!--Brainstorm! How about using an xsl stylesheet to control output
to
the screen, to a file, even to a com port?-->
<xpl:output xpl:where-to="screen">Hell, oh world!</xpl:output>
<xpl:wait-a-sec xpl:until="true">
<xpl:until xpl:string="uppercase">Q</xpl:until>
</xpl:wait-a-sec>
<xpl:end-program/>
</xpl>
*** * * *** * *
* ** ** * ** ** *** ** ***
** * * * *** *** ** * ** ** * * *
* ** * * * ALY HOPKINS * ** * * * * ** * *
* * ** interplanetary illuminations * * * *** ** **
** ** * * * * * a specialty * ** * * * * * * ** **
** * * * p061949c@p... * ** * ** * * **
* * * * ******* * * * * * * ** * * * ** * *
* * ** * ** ** *** * * ** * ** * ** *** *
* * ** *** * * ** * *** * * * **
* ** * ** * * * * * *
--- End forwarded message ---
|