Warning:
This wiki has been archived and is now read-only.

DISelect-Separation

From UWA
Jump to: navigation, search

Initial ideas to isolate DISelect expressions from the presentational markup in DIAL

Contributors: José Manuel Cantera Fonseca, Telefónica I+D

Date: September 2007

Current Syntax

DISelect instructions are in the DIAL markup


<sel:select>
          <sel:when expr="eg:supportsContent('image/jpeg')">
            <img src="bigmsflood.jpeg" />    
          </sel:when>
          <sel:when expr="eg:supportsContent('image/gif')">
            <img src="bigmsflood.gif" />    
          </sel:when>
</sel:select>


Main Drawbacks

  • Mix content selection with the general structure of the page
  • Hard to read and mantain
  • Hard to reuse expressions in an application or sets of applications
  • Difficult to implement


Alternative representation

  • There is a separation between selection aspects and structural aspects.
  • A DIAL authored unit references a selection authoring unit.
  • There is a binding between DISelect block and a DIAL block. A DIAL block that bounds to a DISelect block can access all the variables declared under that DISelect block.
  • The DIAL processor must execute the bound DISelect block before rendering.

<?xml version="1.0" encoding="UTF-8"?>
<?diselect href="selection.xml"?>

<!-- Can we declare a DTD and assume implicitly the namespaces to be used -->
<html xmlns:sel="http://www.w3.org/2004/06/diselect" 
	xmlns="http://www.w3.org/2002/06/xhtml2/">
	<head>
		<title>This is an IDEAL page</title>
		<link rel="style" href="mystylesheet.css" />
	</head>
	<body>
		<div>
			<img sel:blockid="block1" src="{$myImage}" />
		</div>
	</body>
</html>

<!-- selection.xml -->

<?xml version="1.0" encoding="UTF-8"?>

<diselect xmlns="http://www.w3.org/2004/06/diselect">
	<diblock id="block1">
	     <variable name="myImage" value="" />
              <sel:select>
                <sel:when expr="eg:supportsContent('image/jpeg')">
                      <sel:variable ref="myImage" value="bigmsflood.jpeg">   
               </sel:when>
               <sel:when expr="eg:supportsContent('image/gif')">
                      <sel:variable ref="myImage" value="bigmsflood.gif">
               </sel:when>
              </sel:select>		
        </diblock>
</diselect>

References

Elliot's Rusty Harold comments