#!/bin/bash # Extract all element names declared by a DTD, and make an empty # XSLT transform with an entry for each of them. # # Not guaranteed to do it all right: # Doesn't handle parameter entities, marked sections, comments. # Doesn't handle any external files included # (to get these, list them on the command line) # # Steven J. DeRose 2005-12-16, sderose\@acm.org, sderose@acm.org cat $* |\ sed 's/(<.ELEMENT[^>]+)\n/\1 /' |\ sed 's/[ \t]*<.ELEMENT/<.ELEMENT/g' |\ sed "s/\(<.ELEMENT\)[ ]*/\1 /" |\ grep '<.ELEMENT' |\ sed "s/<.ELEMENT[ ]//" |\ sed "s/\([-_.a-zA-Z0-9]+\).*/&/" |\ sed "s.*/\ \ \ \ \ \ \ \ \ <\/xsl:template>/"