Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: XSLT from a XSD spec. >Thread Next - Re: XSLT from a XSD spec. Re: XSLT from a XSD spec.To: NULL Date: 10/4/2006 10:36:00 PM Peter Flynn ha escrito: Hi! > Gilgamesh wrote: > > Hi. > > > > I'm looking for an easy way to generate, automatically, an XSLT from an > > XSD, to be applied to a XML file (conforming the previous XSD) and > > generate an HTML. Many of you will tell me that this is nonsense, > > Usually because there is no obvious way to know what HTML > your <a1> element type ought to be output as, for example. > Yep, that should be fixed, say, to H1 .. H9, or to different levels of indentation, corresponding to the different depth in the tree. > There is an infinite number of ways of doing it, so how do > you decide what is the "right" way for arbitrary XML. > > I agree that if the element type names have an accepted > meaning in some language (eg <para>) then some of the > decisions are obvious, but more often they are not. > > > I think it can be done, given the condition that the XML file (as > > specified in the XSD) always has a root element (although it would be > > nice if the root element name could be a parameter of the XSLT), > > The root element name of an XML document is always given > by the XPath expression /*[1]/name() > > > and a > > given hierarchy of sub-elements, until a level N where there is a list > > of data elements, like this: > > > > <root> > > <a1> > > <b1> > > <c1> > > <d>D Value</d> > > <e>E Value</e> > [snip] > > But what makes you think all document types follow this pattern? > What you ask for may be valid for a very restricted subset of highly > specialist document types, but here's a paragraph of the kind of > XML I deal with: > Well, the point is that I have the .XSD, and what is specified in the .XSD is a simple hierarchy like the one shown above, and therefore all XML conforming to that .XSD should have that form. J C | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
