OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

ubl-dev message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [ubl-dev] 'Opensource' XForms for UBL


Hi

Just got back to emails after the holidays here and very encouraged
at the interest there is about input forms. Thanks guys.

I set up a project on sourceforge
https://sourceforge.net/projects/xforms4ubl
but haven't yet worked out how to upoad to it. Maybe I'll have
done so by the time some folk read this. I do have some initial
XForms and stylesheets in XSLT for generating them to upload
as soon as I can.

Thanks, Jan, for the question about the use cases. Maybe the
communities of interest are likely to be government and the
governed (isn't that all of us?) - where there is a need for
information gathering in the form of some kind of XML but
where the ideal sought after is to encourage that input to be
gathered in 'standard' XML format rather than what is most
convenient for the product used (even though it might be XML).
So for the spreadsheet forms, for instance, could fulfil this part
of the use case at least. It might be that the problems with
the latter occur when political matters are considered though
so XForms might fill a gap that the spreadsheets leave. Plus the
gap could be economic too (more the lines along which I'm
thinking) and having browser and plugin and the forms themselves
all avalable as opensource for free download might go a long way
to meeting such needs where cash-strapped-but-Internet-connected
masses are concerned. That may be why governments are more
likely to be interested in this approach. In my town most can get
to an Internet access point just by walking into town and using
one in the street (like telephone boxes or post boxes) and if XForms
were in future to work on those it might help all sorts of admin
problems. UBL is a key part of this but I guess the whole thing can be
extended a lot and other XML standards fit in for other requirements.
So this project could be something of an example too.

I had difficulties too with the spreadsheet option in that I couldn't
get the functionality I thought input into UBL format would need.
I can get this better with XForms now that there is almost native
browser support. Plus intellectual property might be an issue for
some of the spreadsheets which offer most promising functionality.
(Trying to avoid product naming for some reason here, not sure
why, sorry.) Then there is the big factor of being able to generate
the form from an instance or schema (former in my case) - not sure
this can be done out-of-the-box for a spreadsheet form. This helps
when there is not so much needed by way of functionality (it can
be added later if there is) but there needs to be quick development
(as for being able to offer the work freely) and this needs to be
adaptable to variations in the underlying standard (as with the
customisable UBL documents/library). Great to see how far Chee-Kai
has got with the spreadsheet option though, great work.

So I hope that answers questions.

I gather the server doesn't allow attachments in archiving but
I did find Chee-Kai's attachments got through to my email system
so I'll add an XForms sample - just a crude starting point - with the
XSLT that generates it. I find they work with mozilla-based browsers
with their xforms plugin.

All the best

Steve

Quoting Jan Algermissen <algermissen1971@mac.com>:

> Hi Stephen,
>
> what Problem/Use Case do you intend to solve with the Forms and can you
> sketch an example that gives an impression what you have in mind?
>
> This is somewhat related:
>
> I am considering to use UBL in an integration project that builds upon
> Web architecture (as opposed to WS-* Web Services) with strong use of
> the Atom syndication format. To really bring UBL on the Web, a UBL mime
> type would be necessary (say application/ubl+xml) but so far, there is
> appearently no effort to do define one.
>
> What is the groups general position towards a UBL mime type and would
> anybody be interested to participate?
>
> (A UBL mime type would for example enable services to declare that they
> accept POST requests with UBL payload. Simply using a form+schema
> approach as XForms (in part) suggests isn't sufficient from a
> Web/interoperability POV).
>
> Thanks for any feedback on this.
>
> Jan
>
>
> On Dec 21, 2006, at 3:40 PM, stephen.green@systml.co.uk wrote:
>
>> Folks,
>>
>> I've had it in mind to start an opensource project (maybe sourceforge)
>> to create XForms forms for UBL. I've a form which could be a starting
>> point. It would be the first time I've tried such a project so it could be
>> a while before anything gets going but if anyone is interested and
>> patient enough to keep an eye out for future announcements... or
>> has ideas about it in general I'd be grateful to hear any feedback. I
>> guess it could go a long way or just fizzle out but either way might
>> produce something to help others trying to do something similar and
>> provide for validation (or otherwise) of some of the proposals for
>> UBL deployment (such as codelists and business rules, say). Of course
>> it seems unusual to have a project like this for XForms but why not.
>> I've seen such projects around to develope XSLT stylesheets. Plus a
>> stylesheet to dynamically create the XForms from UBL artefacts could be
>> part of it too.
>>
>> Any thoughts?
>>
>> All the best and seasons greetings
>>
>> Stephen Green
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ubl-dev-unsubscribe@lists.oasis-open.org
>> For additional commands, e-mail: ubl-dev-help@lists.oasis-open.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ubl-dev-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: ubl-dev-help@lists.oasis-open.org


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml"; xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:xforms="http://www.w3.org/2002/xforms"; xmlns:stat="urn:oasis:names:specification:ubl:schema:xsd:DocumentStatusCode-1.0" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-1.0" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-1.0" xmlns:default="urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-1.0" xmlns:ev="http://www.w3.org/2001/xml-events"; xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
	<xsl:output indent="yes" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"; encoding="utf-8"/>
	<xsl:template match="/">
		<html xmlns:xforms="http://www.w3.org/2002/xforms";>
			<head>
				<title><xsl:value-of select="local-name(/)"/></title>
				<xforms:model id="m1">
					<xforms:instance id="i1">
						<xsl:copy-of select="/*"/>
					</xforms:instance>
					<xforms:submission method="put" id="s1" action="./XFormsOutput1.xml"/>
				</xforms:model>
				<link rel="stylesheet" href="./style.css" type="text/css"/>
			</head>
			<body>
				<p>
					<xforms:submit submission="s1">
						<xforms:label>Submit</xforms:label>
					</xforms:submit>
				</p>
				<h1>
					<xsl:value-of select="local-name(/*)"/>
				</h1>
				<xsl:apply-templates mode="inputs" select="/*"/>
			</body>
		</html>
	</xsl:template>
	<xsl:template mode="inputs" match="/*">
		<xsl:apply-templates mode="recurse" select="*"/>
	</xsl:template>
	<xsl:template match="@*" mode="attribute">
		<xforms:input model="m1">
			<xsl:attribute name="ref"><xsl:for-each select="ancestor-or-self::*"><xsl:if test="local-name()=name()">/default:</xsl:if><xsl:if test="not(local-name()=name())">/</xsl:if><xsl:value-of select="name()"/>[<xsl:number/>]</xsl:for-each>/@<xsl:value-of select="name()"/></xsl:attribute>
			<xforms:label>
				<xsl:value-of select="translate(local-name(.),'-.:','')"/>
			</xforms:label>
		</xforms:input>
		<br/>
	</xsl:template>
	<xsl:template mode="recurse" match="/default:DespatchAdvice/cac:DespatchLine[1]">
		<xforms:repeat nodeset="/default:DespatchAdvice/cac:DespatchLine" id="rt1" model="m1">
			<xsl:apply-templates mode="recurse.repeat.line" select="/default:DespatchAdvice/cac:DespatchLine[1]"/>
			<xforms:trigger>
				<xforms:label>Add Line</xforms:label>
				<xforms:insert at="index('rt1')" position="after" nodeset="/default:DespatchAdvice/cac:DespatchLine" ev:event="DOMActivate"/>
			</xforms:trigger>
			<xforms:trigger>
				<xforms:label>Remove Line</xforms:label>
				<xforms:delete at="index('rt1')" nodeset="/default:DespatchAdvice/cac:DespatchLine" ev:event="DOMActivate"/>
			</xforms:trigger>
		</xforms:repeat>
		<br/>
	</xsl:template>
	<xsl:template mode="recurse.repeat.line" match="*">
		<xsl:if test="not(*)">
			<xforms:input model="m1">
				<xsl:attribute name="ref"><xsl:for-each select="ancestor-or-self::*[not(self::cac:DespatchLine | self::default:DespatchAdvice)]"><xsl:if test="not(parent::cac:DespatchLine | parent::default:DespatchAdvice)">/</xsl:if><xsl:if test="local-name()=name()">default:</xsl:if><xsl:if test="not(local-name()=name())"/><xsl:value-of select="name()"/>[<xsl:number/>]</xsl:for-each></xsl:attribute>
				<xforms:label>
					<xsl:value-of select="translate(local-name(.),'-.:','')"/>
				</xforms:label>
			</xforms:input>
			<br/>
		</xsl:if>
		<xsl:if test="*">
			<h2>
				<xsl:value-of select="local-name(.)"/>
			</h2>
		</xsl:if>
		<xsl:apply-templates mode="attribute.repeat.line" select="@*"/>
		<xsl:apply-templates mode="recurse.repeat.line" select="./*"/>
		<br/>
	</xsl:template>
	<xsl:template match="@*" mode="attribute.repeat.line">
		<xforms:input model="m1">
			<xsl:attribute name="ref"><xsl:for-each select="ancestor-or-self::*[not(self::cac:DespatchLine | self::default:DespatchAdvice)]"><xsl:if test="not(parent::cac:DespatchLine | parent::default:DespatchAdvice)">/</xsl:if><xsl:if test="local-name()=name()">default:</xsl:if><xsl:if test="not(local-name()=name())"/><xsl:value-of select="name()"/>[<xsl:number/>]</xsl:for-each>/@<xsl:value-of select="name()"/></xsl:attribute>
			<xforms:label>
				<xsl:value-of select="translate(local-name(.),'-.:','')"/>
			</xforms:label>
		</xforms:input>
		<br/>
	</xsl:template>
	<xsl:template mode="recurse" match="*">
		<xsl:if test="not(self::cac:DespatchLine)">
			<xsl:if test="not(*)">
				<xforms:input model="m1">
					<xsl:attribute name="ref"><xsl:for-each select="ancestor-or-self::*"><xsl:if test="local-name()=name()">/default:</xsl:if><xsl:if test="not(local-name()=name())">/</xsl:if><xsl:value-of select="name()"/>[<xsl:number/>]</xsl:for-each></xsl:attribute>
					<xforms:label>
						<xsl:value-of select="translate(local-name(.),'-.:','')"/>
					</xforms:label>
				</xforms:input>
				<br/>
			</xsl:if>
			<xsl:if test="*">
				<h2>
					<xsl:value-of select="local-name(.)"/>
				</h2>
			</xsl:if>
			<xsl:apply-templates mode="attribute" select="@*"/>
			<xsl:apply-templates mode="recurse" select="./*"/>
			<br/>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>

XForms4UBL1DespatchAdvice-A-v0-1-4.xhtml

/* xforms.css */
@namespace xhtml url("http://www.w3.org/1999/xhtml";);
@namespace xf url("http://www.w3.org/2002/xforms";);

.header {
	  font-size: 16pt;
	  font-weight: bold;
	  font-style: italic;
	  text-align:center;
}

xf|group {
	display:block;
	width:100%;
	margin-top: 5px; 
	margin-bottom: 5px;
	margin-right: 7px;
}

xf|group xf|group, xf|group xf|repeat, xf|repeat xf|repeat {
	margin-left: 15px;
	width: 95%;
	background-color: rgb(216, 216, 177); 
}


xf|group > xf|label {
	font-weight: bold;
	font-size: larger; 
}

xf|input, xf|select1, xf|output, xf|select, xf|upload {
	display:block; 
}

xf|input > xf|label, xf|select1 > xf|label, xf|output > xf|label, 
xf|select > xf|label, xf|upload > xf|label {
	display: block;
	width:180px;
    float:left;
	padding-left:20px;
	font-weight: bold;
}

xf|input .xf-value {
   background-color: white;	
   width: 280px;
}
xf|input::value {
   background-color: white;	
   width: 280px;
}

xf|output .xf-value {
   background-color: rgb(233, 233, 233); 
   width: 280px;
}
xf|output::value {
   background-color: rgb(233, 233, 233); 
   width: 280px;
}

.xf-repeat-item, .repeat-item {
  border: thin; border-color: black; border-style: dotted; margin-top: 5px;}
.xf-repeat-index, .repeat-index {
  border: medium; border-color: green; border-style: double; background-color: rgb(236,236,217);}

.invalid { border-style: solid; border-width: 2px; border-color: red; !important;}
xf|*:disabled { display: none; }


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]