On 12.05.2004 23:59, Sylvain Wallez wrote:
- re-introduce fi:styling/type='date' to explicitely call the template, but now ignoring any possible formatting pattern (since we know it from the widget's datatype)
IIUC, you propose that fi:datatype has no influence on the chosen styling, but gives the format _when_ fi:styling/@type="date" is present, right?
Then a big +1000 !
Having the style driven by both the datatype and styling type will lead to an incredible combinational mess, which we just start to see with this conflict between @type="output" and fi:datatype.
fi:styling/@type chooses the styling, which can then use some additional information such as fi:datatype to fine tune the widget's representation.
If we agree that only fi:styling/@type drives the rendering type, then let's do it right now.
I remember that it was me who asked for simple datatype driven styling of date fields - and Bruno added the datatype feature in that way. Otherwise you always have to add styling/@type="date" to the template.
I understand this need, and that's why I'd like to allow <fi:styling> beside <fi:label> in a <fd:field>. Combined with widget repositories, this will allow definitions like this :
<!-- type repository -->
<fd:field defines="date-field">
<fi:styling type="date">
<fd:datatype base="date">
<fd:convertor type="formatting">
... patterns ..
</fd:convertor>
</fd:datatype>
</fd:field><!-- form definition --> <fd:field id="start-date" extends="date-field"> <fi:label>Start date</fi:label> </fd:field>
<fd:field id="end-date" extends="date-field"> <fi:label>End date</fi:label> <fd:validation> <fd:assert test="end-date > start-date"/> </fd:validation> </fd:field>
I guess the datatype has no influence on fi:styling?
I depends: type="date" is obviously related to a date datatype.
To solve the current problem, we can consider than date styling is a "sub-styling" of the regular <fi:field> styling (that normally produces an <input>) implemented in forms-calendar-styling.xsl by means of something like :
<xsl:template match="fi:field[not(fi:styling/@type)]">
<xsl:choose>
<xsl:when test="fi:[EMAIL PROTECTED]'date']">
... calendar popup ...
</xsl:when>
<xsl:otherwise>
<xsl:apply-imports/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>OOP inheritance applied to XSLT!
How does it sound ?
Sylvain
-- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
