RE: [xsl] Translating XSD into an XSLT, experts approach needed

Subject: RE: [xsl] Translating XSD into an XSLT, experts approach needed
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 24 Feb 2004 23:34:45 -0000
The answer is, it all depends...

You're assuming a particular scenario: the schema (and presumably the source
documents) already exist, and you're given the job of writing a stylesheet
to display them (or transform them?). In this scenario, the next question
is, who designs the visual display format? Is the stylesheet designer
designing the visual rendition, or is s/he trying to achieve a visual
rendition designed by someone else?

Other scenarios include designing the visual output first and working back
from that to the design of the XML Schema, or various combinations of the
two.

It's certainly never a pure case of "the schema allows an X here, what
should I do if I find one?". In some cases the process may be totally
output-driven ("I need to put the customer name at this place on the screen,
where do I find it in the source document"), in most cases it will be
looking at both the available input and the required output, and in many
cases either or both of these will be moveable feasts.

Michael Kay

# -----Original Message-----
# From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-
# list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Daniel Bryant
# Sent: 24 February 2004 19:51
# To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
# Subject: [xsl] Translating XSD into an XSLT, experts approach needed
# 
# Hi,
# 
# I am currently working on my final year dissertation for a degree in
# computing. My dissertation involves the automatic translation of an XSD
# into
# an XSLT that will display an XML document compliant to the XSD as an XHTML
# web page. As part of my research I have to investigate and document how a
# human expert approaches the task of translating an XSD into an XSL
# document.
# 
# If anyone could spare a few minutes briefly documenting how they would
# approach translating the XSD below (or even general approaches to
# translation), I would be very grateful. Examples of what I'm looking for:
# 
# - The order of translation; i.e. do you create your XSL document by
# working
# down through the XSD code, do you pick out certain elements or do you use
# recursive methods / or a tree traversal method, preorder etc.
# - Do you write one template at a time or work on multiple ones.
# - Does the approach taken to generate the XSL code differ for each type of
# element (i.e. when translating strings, ints and custom types)
# - Are there any elements in an XSD that cause particular problems when
# translating, or you think would in automatic translation?
# - How do you approach writing XSL to display attributes, and when is this
# done in the translation process?
# - How (if at all) do you optimise your XSL code?
# - How do you debug errors?
# 
# Kind regards,
# 
# Daniel Bryant
# (Undergraduate, University of Surrey)
# 
# <?xml version="1.0" encoding="UTF-8"?>
# <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
# elementFormDefault="qualified" attributeFormDefault="unqualified">
#   <xs:element name="ANIMAL">
#     <xs:complexType>
#       <xs:sequence>
#         <xs:element name="DOG">
#           <xs:complexType>
#             <xs:sequence>
#               <xs:element name="ALSATION">
#                 <xs:complexType>
#                   <xs:sequence>
#                     <xs:element name="AGE">
#                       <xs:simpleType>
#                         <xs:restriction base="xs:int">
#                           <xs:minExclusive value="0"/>
#                           <xs:maxExclusive value="14"/>
#                         </xs:restriction>
#                       </xs:simpleType>
#                     </xs:element>
#                     <xs:element name="WEIGHT" type="xs:string"/>
#                     <xs:element name="COAT_COLOUR" type="xs:string"/>
#                   </xs:sequence>
#                   <xs:attribute name="Name" type="xs:string"
# use="optional"/>
#                 </xs:complexType>
#               </xs:element>
#               <xs:element name="MUNGREL">
#                 <xs:complexType>
#                   <xs:simpleContent>
#                     <xs:extension base="xs:string">
#                       <xs:attribute name="Name" type="xs:string"
# use="optional"/>
#                     </xs:extension>
#                   </xs:simpleContent>
#                 </xs:complexType>
#               </xs:element>
#             </xs:sequence>
#           </xs:complexType>
#         </xs:element>
#         <xs:element name="CAT">
#           <xs:complexType>
#             <xs:sequence>
#               <xs:element name="PERSIAN">
#                 <xs:simpleType>
#                   <xs:restriction base="xs:string">
#                     <xs:minLength value="0"/>
#                     <xs:maxLength value="10"/>
#                   </xs:restriction>
#                 </xs:simpleType>
#               </xs:element>
#             </xs:sequence>
#           </xs:complexType>
#         </xs:element>
#       </xs:sequence>
#     </xs:complexType>
#   </xs:element>
# </xs:schema>
# 
# 
#  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread