cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neeme Praks" <ne...@one.lv>
Subject RE: Thoughts on a data-driven web site
Date Wed, 21 Jun 2000 20:57:56 GMT

> -----Original Message-----
> From: Jonathan Stimmel [mailto:jon-lists@stimmel.net]
> Sent: Wednesday, June 21, 2000 9:47 PM

[snip]

> I did overlook this problem in my email, but I have thought about it.
> Our pages have a lot of cursory information that you wouldn't want to
> send to a mobile device. There are definite performance 
> benefits to only
> loading the data you will actually be using which I believe 
> will outweigh
> the (minimal) effort needed to maintain the additional source 
> documents.
> The underlying directory structure would look something like:
>   wap/index.xml              html/index.xml
>   wap/index.xsl              html/index.xsl
>   wap/news/index.xml         html/news/index.xml
>   wap/news/index.xsl         html/news/index.xsl
>   wap/weather/index.xml      html/news/index.xml
>   wap/weather/index.xsl      html/news/index.xsl
>   wap/xsl/skin.xsl           html/xsl/skin.xsl
> Still quite managable.

well, in this case I see no benefit in using the "template" XSL file
(stage 3). In this case I could just as well put the structure into the
stage 1 XML file together with the data sources. Then afterwards I could
"skin" this with additional stylesheet if needed...

> Not really, it shows that two different development groups have
> wrestled with the same problem and come to the same conclusions.
> Hopefully that means we're both on the right track =)

;-)
This is what I like about open-source: you can see that you are not
alone in this world with your problems ;-)


To give you a better understanding what did I chose in the end, I can
give a short description and example. The whole system consists of 2
global files:
/en/resources.xml (i18n resource file for english, one flavour of the
XResourceBundles as discussed on this list)
/forms.xml (definitions of forms, to separate the concerns of
information layout and web app development; and to abstract the
application model specifics, as I'm using Jetspeed/Turbine currently,
but I want to use Cocoon2 later on)

And then I have the actual XML file (stage 1) that includes the data
sources and very abstract information layout.

------------------- resources.xml -----------------------
<?xml version="1.0" encoding="UTF-8"?>
<resources xml:lang="en">
  <forms>
	  <contacts-search>
		  <desc>
		    <searchfor>find:</searchfor>
		    <field-to-search>what:</field-to-search>
		    <from>where:</from>
		    <from-mycontacts>my contacts</from-mycontacts>
		    <from-allmembers>all members</from-allmembers>
		  </desc>
	
		  <input>
			  <field-to-search>
			    <all>all</all>
			    <firstname>first name</firstname>
			    <lastname>last name</lastname>
			    <phone>phone</phone>
			    <email>e-mail</email>
			  </field-to-search>
		    <submit>Search</submit>
		  </input>
	  </contacts-search>
  </forms>
</resources>

------------------- forms.xml -----------------------
<?xml version="1.0" encoding="UTF-8"?>
<forms>
	<form ID="contacts-search"><res:group
ref="/forms/contacts-search/input">
		<target>
			<screen/>
			<action>ContactSearch</action>
		</target>
		<method>POST</method>
		<field name="searchfor">
			<name>search-for</name>
			<type>text</type>
			<maxsymbols>10</maxsymbols>
			<symbols>10</symbols>
		</field>
		<field name="fields">
			<name>field</name>
			<type>option</type>
			<values>
				<res:group ref="field-to-search">
					<option name="all">
						<res:resource
ref="all"/>
					</option>
					<option name="firstname">
						<res:resource
ref="firstname"/>
					</option>
					<option name="lastname">
						<res:resource
ref="lastname"/>
					</option>
					<option name="phone">
						<res:resource
ref="phone"/>
					</option>
					<option name="email">
						<res:resource
ref="email"/>
					</option>
				</res:group>
			</values>
		</field>
		<field name="from-mycontacts">
			<name>from-mycontacts</name>
			<type>checkbox</type>
			<value>1</value>
		</field>
		<field name="from-allmembers">
			<name>from-allmembers</name>
			<type>checkbox</type>
			<value>1</value>
		</field>
		<field name="submit">
			<name>search</name>
			<type>submit</type>
			<value>
				<res:resource ref="submit"/>
			</value>
		</field>
	</res:group></form>
</forms>

------------------- one specific page example -----------------------
<portlet>
	<form:form ref="contacts-search">
	<res:group ref="/forms/contacts-search/desc">
		<e:elements>
			<e:element>
				<e:title>
					<res:resource ref="searchfor"/>
				</e:title>
				<e:body>
					<form:field ref="searchfor"/>
				</e:body>
			</e:element>
			<e:element>
				<e:title>
					<res:resource
ref="field-to-search"/>
				</e:title>
				<e:body>
					<form:field ref="fields"/>
				</e:body>
			</e:element>
			<e:element>
				<e:title>
					<res:resource ref="from"/>
				</e:title>
				<e:body>
					<form:field
ref="from-mycontacts"/> <res:resource ref="from-mycontacts"/><br/>
					<form:field
ref="from-allmembers"/> <res:resource ref="from-allmembers"/>
				</e:body>
			</e:element>
			<e:element>
				<e:body>
					<form:field ref="submit"/>
				</e:body>
			</e:element>
		</e:elements>
	</res:group>
	</form:form>
</portlet>

---------------------- the end result should be something like this in
HTML ----------------
<table width="100%" cellpadding="3" cellspacing="0" class="grayBg"
border="0">
<tr>
<td class="smallnormal">
<table width="100%" cellspacing="0" cellpadding="1" border="0">
<tr><td><form></td><td></td></tr>
<tr>
<td width="35%" class="smallnormal" align="right">find:</td>
<td class="smallnormal"><input type="textfield" size="11"
class="smallnormal"></td>
</tr>

<tr>
<td width="35%" class="smallnormal" align="right">what:</td>
<td class="smallnormal"><select>
<option>all</option>
<option>first name</option>
<option>last name</option>
<option>phone</option>
<option>e-mail</option>
</select></td>
</tr>

<tr>
<td width="35%" class="smallnormal" align="right"
valign="middle">where:</td>
<td class="smallnormal"><input type="checkbox" name="1" value=""
checked> my contacts<br>
<input type="checkbox" name="1" value=""> all members</td>
</tr>

<tr>
<td width="35%"></td>
<td class="smallnormal"><input type="image" src="img/bu/sech.gif"
alt="search" border="0">
</tr>

<tr><td></form></td><td></td></tr>

</table>
</td>
</tr>
</table>

----------------------------------------------------
So, how is it supposed to work?

1. user requests this specific URL.
2. the base XML file is processed
3. all references to the forms.xml are replaced with content from there
(XSLT)
4. all tags from XSP taglibs are expanded with a logicsheet (this is not
included in this example)
and
4. all references to resources.xml are replaced with locale specific
content (probably also in XSP)
5. XSP is compiled to Java source
6. all this content is handed to the media/skin specific designer
stylesheet. (this means one sheet per media/skin, not per each original
file)
7. response goes back to client

My underlying directory structure would look something like:
   /index.xml
   /news/index.xml
   /weather/index.xml
   /xsl/wap.xsl
   /xsl/html-skin1.xsl
   /xsl/html-skin2.xsl
with supporting files:
   /en/resources.xml (i18n file)
   /forms.xml
   /forms.xsl
   /logicsheet.xsl

This is not yet fully working example (the namespace declarations are
missing, etc)... I'm still working on this. However, all comments would
be welcome, as always ;-)

I haven't tried to write any final designer stylesheets yet, this is the
job of our designer... So probably I'll have to adjust things then...

And this example is an example of "static" form, no database
interactivity... but I have my ideas about this: everything is in XSP
taglibs and the tags can be in every stage of processing before the
actual XSP processing, this means that I can put dynamic tags in the
file requested, forms.xml or resources.xml.

I hope this all makes some sense...

Neeme

Mime
View raw message