Hi Carl,
> I have used HyperContent to rebuild our recruitment site, which =20
> involved rebuilding our recruitment database using XML and XSL. I =20=
> have been asked that the jobs be displayed in order of closing date =20=
> rather then the date and time stamp created when the job advert was =20=
> added. I have a closing date field specified in a dtd <!ATTLIST =20
> advertbodytext closingdate CDATA #REQUIRED> but obviously it isn=92t =20=
> possible to sort by this because the system doesn=92t see it as a =20
> date. Does anyone know how I might do this?
The easiest way to do this would be to enter the closing date in the =20
dublin core date field of the metadata editor. It accepts an ISO =20
date format that sorts properly as a string in XSL, and overrides the =20=
creation and modified times for the file in sorted navigation lists. =20
The format is "yyyy-MM-dd HH:mm:ssZ". For presentation I've been =20
using this javascript library
/repositories/bootstrap/js/date-functions.js
With this you could do something like
<script>
var timestring =3D '<xsl:value-of select=3D"rdf:RDF/cfs:File/dc:date">';
var date =3D Date.parseDate(timestring,"Y-m-d H:i:sO");
var showdate =3D date.dateFormat("l, F d, Y g:i A");
document.getElementById('date-display').appendChild=20
(document.createTextNode(showdate));
</script>
You should also be able to use EXSLT date functions to parse the date =20=
in XSL for display as well; the only catch is EXSLT supports a =20
slightly different format, which you can get this way:
<xsl:variable name=3D"timestring" select=3D"translate(rdf:RDF/cfs:File/=20=
dc:date,' ','T')"/>
You could of course also have your users enter a date in the same =20
format in your XML, and you could sort it as a string type in XSL. =20
You only have to use the dublin core date field if you want to use =20
navigation files to do the sorting.
It probably wouldn't be too difficult to wire a javascript date =20
chooser into the metadata editor so users wouldn't have to get the =20
format just right. If you'd like, you could open a jira request for =20
this feature.
> I have an enumerated list specified in a dtd <!ATTLIST =20
> eventsbodytext category (International|Consumer|Public|Sea|Other) =20
> #REQUIRED> What I actually need to for the users to select =20
> =91International law, Consumer law=85.=92 =46rom a drop down box in =20=
> HyperContent. You don=92t seem to be able to use spaces in the list =20=
> though. Does anyone have any pointers as to have I might =20
> accomplish this?
>
This has come up before, but there's no way to do it with just a DTD, =20=
since valid XML names can't have spaces. I think the easiest =20
approach might be to support properties files for localization of =20
DTDs, e.g.
/dtd/common.dtd
/dtd/common.properties
International=3DInternational Law
Consumer=3DConsumer Law
I suggest you open a Jira request for this feature as well!
Cheers,
Alex=
|