• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!-- Generate Java code to be inserted into HTMLModels.java.  -->
2
3<!--
4// This file is part of TagSoup and is Copyright 2002-2008 by John Cowan.
5//
6// This file is part of TagSoup and is Copyright 2002-2008 by John Cowan.
7//
8// TagSoup is licensed under the Apache License,
9// Version 2.0.  You may obtain a copy of this license at
10// http://www.apache.org/licenses/LICENSE-2.0 .  You may also have
11// additional legal rights not granted by this license.
12//
13// TagSoup is distributed in the hope that it will be useful, but
14// unless required by applicable law or agreed to in writing, TagSoup
15// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
16// OF ANY KIND, either express or implied; not even the implied warranty
17// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18-->
19
20<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
21	xmlns:tssl="http://www.ccil.org/~cowan/XML/tagsoup/tssl"
22	version="1.0">
23
24  <xsl:output method="text"/>
25
26  <xsl:strip-space elements="*"/>
27
28  <!-- The main template.  We are going to generate Java constant
29       definitions for the groups in the file.  -->
30  <xsl:template match="tssl:schema">
31    <xsl:apply-templates select="tssl:group">
32      <xsl:sort select="@id"/>
33    </xsl:apply-templates>
34  </xsl:template>
35
36  <!-- Generate a declaration for a single group.  -->
37  <xsl:template match="tssl:group" name="tssl:group">
38    <xsl:param name="id" select="@id"/>
39    <xsl:param name="number" select="position()"/>
40    <xsl:text>&#x9;public static final int </xsl:text>
41    <xsl:value-of select="$id"/>
42    <xsl:text> = 1 &lt;&lt; </xsl:text>
43    <xsl:value-of select="$number"/>
44    <xsl:text>;&#xA;</xsl:text>
45  </xsl:template>
46
47</xsl:transform>
48