xbmono
xbmono

Reputation: 2316

How to generate simple documentation from XSD using XSLT

We have several XSD files and one of them has the root element and others are imported or included. These XSD files represents an XML service request... for documentation reason, I need to extract all the element names and attributes under the root element.

What I need is to produce something like this:

<table>
  <tr>
     <td>ELELEMENT OR ATTRIBUTE NAME</td> 
     <td>Whether or not mandatory - by checking minOccurs="0"</td>
     <td>EMPTY OR THE TEXT VALUE under annotation/documentation IF AVAILABLE</td>
  </tr> 
</table>

Upvotes: 2

Views: 3738

Answers (3)

Simon
Simon

Reputation: 432

I made an xslt stylesheet that does exactly what you asked for: https://github.com/S2-/xsddoc

Upvotes: 1

C. M. Sperberg-McQueen
C. M. Sperberg-McQueen

Reputation: 25054

There are several tools to generate HTML from sets of XSD schema documents; some are listed at the W3C page on XSD. The page is increasingly out of date, but many of the tools it lists are still available.

Upvotes: 1

Michael Kay
Michael Kay

Reputation: 163595

You might like to consider rendering the schema using Michael Sperberg-McQueen's stylesheet at http://www.w3.org/2008/09/xsd.xsl, or adapting this to your requirements. It works best when the schema contains extensive XHTML-formatted documentation.

Upvotes: 2

Related Questions