TEI stylesheet for making Relax NG schema from ODD
This library is free software; you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License as published by the Free Software Foundation;
either version 2.1 of the License, or (at your option) any later version. This library is
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public License for more details. You should have received a copy of the GNU Lesser
General Public License along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<xsl:template name="schemaSpecBody"><xsl:variable name="pass1"><root><xsl:if test="$verbose='true'"><xsl:message>start importing moduleRef components</xsl:message></xsl:if><xsl:apply-templates mode="tangle" select="tei:moduleRef"/><xsl:for-each select="tei:macroSpec"><xsl:apply-templates mode="tangle" select="."/></xsl:for-each><xsl:apply-templates mode="tangle" select="tei:elementSpec|tei:classSpec"/><xsl:choose><xsl:when test="@start and @start=''"/><xsl:when test="@start and contains(@start,' ')"><start xmlns="http://relaxng.org/ns/structure/1.0"><choice><xsl:call-template name="startNames"><xsl:with-param name="toks" select="@start"/></xsl:call-template></choice></start></xsl:when><xsl:when test="@start"><start xmlns="http://relaxng.org/ns/structure/1.0"><ref name="{$generalPrefix}{@start}"/></start></xsl:when><xsl:when test="key('IDENTS','teiCorpus')"><start xmlns="http://relaxng.org/ns/structure/1.0"><choice><ref name="{$generalPrefix}TEI"/><ref name="{$generalPrefix}teiCorpus"/></choice></start></xsl:when><xsl:otherwise><start xmlns="http://relaxng.org/ns/structure/1.0"><ref name="{$generalPrefix}TEI"/></start></xsl:otherwise></xsl:choose></root></xsl:variable><!-- in 2nd and 3rd passes, throw away any RNG <define> elements
which do not have a <ref>, any <ref> which has no <define>
to point to, and any empty <choice> --><xsl:variable name="pass2"><xsl:for-each select="$pass1/root"><root><xsl:apply-templates mode="pass2"/></root></xsl:for-each></xsl:variable><xsl:for-each select="$pass2/root"><xsl:apply-templates mode="pass3"/></xsl:for-each></xsl:template>
<xsl:template name="NameList"><!-- walk over all the elementSpec elements and make list of
elements --><xsl:for-each select="key('ELEMENTDOCS',1)"><xsl:sort select="@ident"/><define xmlns="http://relaxng.org/ns/structure/1.0" combine="choice" name="{@ident}"><notAllowed/></define></xsl:for-each></xsl:template>