diff options
Diffstat (limited to 'tssl/tssl-models.xslt')
-rw-r--r-- | tssl/tssl-models.xslt | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tssl/tssl-models.xslt b/tssl/tssl-models.xslt new file mode 100644 index 0000000..6a983b4 --- /dev/null +++ b/tssl/tssl-models.xslt @@ -0,0 +1,47 @@ +<!-- Generate Java code to be inserted into HTMLModels.java. --> + +<!-- +// This file is part of TagSoup and is Copyright 2002-2008 by John Cowan. +// +// This file is part of TagSoup and is Copyright 2002-2008 by John Cowan. +// +// TagSoup is licensed under the Apache License, +// Version 2.0. You may obtain a copy of this license at +// http://www.apache.org/licenses/LICENSE-2.0 . You may also have +// additional legal rights not granted by this license. +// +// TagSoup is distributed in the hope that it will be useful, but +// unless required by applicable law or agreed to in writing, TagSoup +// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS +// OF ANY KIND, either express or implied; not even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +--> + +<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:tssl="http://www.ccil.org/~cowan/XML/tagsoup/tssl" + version="1.0"> + + <xsl:output method="text"/> + + <xsl:strip-space elements="*"/> + + <!-- The main template. We are going to generate Java constant + definitions for the groups in the file. --> + <xsl:template match="tssl:schema"> + <xsl:apply-templates select="tssl:group"> + <xsl:sort select="@id"/> + </xsl:apply-templates> + </xsl:template> + + <!-- Generate a declaration for a single group. --> + <xsl:template match="tssl:group" name="tssl:group"> + <xsl:param name="id" select="@id"/> + <xsl:param name="number" select="position()"/> + <xsl:text>	public static final int </xsl:text> + <xsl:value-of select="$id"/> + <xsl:text> = 1 << </xsl:text> + <xsl:value-of select="$number"/> + <xsl:text>;
</xsl:text> + </xsl:template> + +</xsl:transform> |