File: level-transform.xsl

package info (click to toggle)
atomix 44.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,040 kB
  • sloc: ansic: 4,579; python: 7; makefile: 4
file content (47 lines) | stat: -rw-r--r-- 1,381 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

  <xsl:template match="environment">
    <environment n_columns="{n_columns/text()}" n_rows="{n_rows/text()}">
      <xsl:apply-templates />
    </environment>
  </xsl:template>
  <xsl:template match="scenario">
    <scenario n_columns="{n_columns/text()}" n_rows="{n_rows/text()}">
      <xsl:apply-templates />
    </scenario>
  </xsl:template>
  <xsl:template match="goal">
    <goal n_columns="{n_columns/text()}" n_rows="{n_rows/text()}">
      <xsl:apply-templates />
    </goal>
  </xsl:template>
  <xsl:template match="row">
     <xsl:apply-templates />
  </xsl:template>
  <xsl:template match="col">
    <position>
      <xsl:attribute name="row">
        <xsl:value-of select="../@no" />
      </xsl:attribute>
      <xsl:attribute name="col">
        <xsl:value-of select="@no" />
      </xsl:attribute>
      <xsl:apply-templates />
    </position>
  </xsl:template>
  <xsl:template match="tile">
     <tile type="{type/text()}" base="{base/text()}">
       <xsl:apply-templates />
     </tile>
  </xsl:template>
  <xsl:template match="n_columns|n_rows|type|base"/>

</xsl:stylesheet>