[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Looking for a schema->html form XSL transform
Very good point about xsd:any and the general case. Using this method requires that the designer know what can be in the schema, and thus what can be on the form. And before anyone jumps all over me for imposing my imperfect cognitive frames on the possible contents of a document, I've changed my address 5 times in the last 10 years and the DMV change of address form has looked the same every time :-) Patrick -----Original Message----- From: Klotz, Leigh [mailto:Leigh.Klotz@p...] Sent: Friday, August 08, 2003 3:51 PM To: Patrick Garvey (Engineering); Klotz, Leigh; 'cameron@s...'; 'xml-dev@l...' Subject: RE: Looking for a schema->html form XSL transform That's great reference for the original question. Thank you for showing how XSLT can be used to generate an XForms document. As for the non-generative question, the lack of a single top-level element was just an example, and can of course be worked around by specifying, outside the Schema, a toplevel element. But I believe that in the general case, an XML Schema cannot be used to generate a unique prototype document that can be edited just by filling in simple element content and attributes. If the user agent is allowed to alter the structure of the document (i.e., by y adding elements and attributes where none were generated from the transformation on the Schema), then that begs the question of whether the document is indeed generated from the Schema, since the user is in this case generating the document. Here are two examples of Schemas that do not have enough information about their structure to generate documents by any means other than infinite enumeration of all legal documents followed by a "Y or N?" dialog, or by using an editor that already understands Schema structures and letting the user add any structure necessary. 1. xsd:any <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.example.com" xmlns:e="http://www.example.com"> <xs:element name="instance"> <xs:complexType> <xs:sequence> <xsd:any namespace="##any" processContents="skip" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> You might argue that this is a trival Schema, but in fact I extracted it from the Schema for XForms itself. 2. The Schema for modularized XHTML 1.1: http://www.w3.org/TR/xhtml-m12n-schema/xhtml-m12n-schema.html#a_schema_xhtml 11 Note that if you can write an XSLT transformation that takes this as input and produces an editor that can output all documents that are valid by this Schema, you will have produced a general XHTML editor! Leigh. -----Original Message----- From: Patrick.Garvey@t... [mailto:Patrick.Garvey@t...] Sent: Friday, August 08, 2003 2:00 PM To: Leigh.Klotz@p...; cameron@s...; xml-dev@l... Subject: RE: Looking for a schema->html form XSL transform How is an XML Schema non-generative? There are top level elements that show what the root element is. This element has a type, which has child elements, etc. If there are multiple top level elements in the schema, just pass in a parameter to the stylesheet with the name of the root element you want in your result document and follow the tree all the way to the end. See http://www.xml.com/pub/a/2003/01/15/transforming-schemas.html?page=1, or the "User Interface Generation" chapter from the following paper, which describes how one can generate an XForms from a schema using XSLT (and borrowed heavily from the examples in the xml.com article): http://dream.sims.berkeley.edu/CDE/report/go-five-final-report.html ------------------------------------- Patrick Garvey Document Engineer Talaris Corporation 1400 Fashion Island Boulevard San Mateo, CA, 94404 (650) 212 8434 phone (650) 212 8499 fax pgarvey@t... http://www.talaris.com Red Herring "Top 10 Companies to Watch" InfoWorld "Top 100 Technology Innovators" Enterprise 2002 "Top 5 New Big Thing" -----Original Message----- From: Klotz, Leigh [mailto:Leigh.Klotz@p...] Sent: Friday, August 08, 2003 1:22 PM To: 'Cameron Shorter'; 'xml-dev@l...' Subject: RE: Looking for a schema->html form XSL transform An XML Schema is not generative; i.e., doesn't have enough information in it to provide the basic structure of a document, so you need to start with something that says what the root element it, what elements come next, etc. If you start with a sample XML document with blanks for the content, then you can use any XForms processor to do what you're asking. You do need to provide the human-readable labels for the fields you want the user to edit, and an XPath expression that says where those fields are in the initial document. If you specify one or more XML Schemas, they will be used to validate the resulting document before it is POSTed back as XML. See http://www.w3.org/MarkUp/Forms and http://www.w3.org/MarkUp/Forms/Test/ImplementationReport.html two fully-conformant implementations, one of which runs inside Internet Explorer. There are also some JavaScript-based implementations; they aren't fully conformant with the XForms spec, but might be good enough for your purposes. IBM has one available form download and testing. Leigh. -----Original Message----- From: Cameron Shorter [mailto:cameron@s...] Sent: Friday, August 08, 2003 2:01 PM To: xml-dev@l... Subject: Looking for a schema->html form XSL transform Hi, I want to: 1. Use XSL to build a HTML form from a schema, then 2. Build XML from the elements in the form and POST the xml back to a server. Does anyone know of XSL or javascript I can use which will address either of the above? -- Cameron Shorter http://cameron.shorter.net Open Source Developer http://generguide.sourceforge.net http://mapbuilder.sourceforge.net http://geotools.org Senior Software Engineer http://www.adi-limited.com ----------------------------------------------------------------- The xml-dev list is sponsored by XML.org <http://www.xml.org>, an initiative of OASIS <http://www.oasis-open.org> The list archives are at http://lists.xml.org/archives/xml-dev/ To subscribe or unsubscribe from this list use the subscription manager: <http://lists.xml.org/ob/adm.pl>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|