File: chado-create-feature-nesting.xsl

package info (click to toggle)
libchado-perl 1.23-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 23,976 kB
  • ctags: 10,378
  • sloc: xml: 192,540; sql: 165,945; perl: 28,339; sh: 101; python: 73; makefile: 46
file content (51 lines) | stat: -rw-r--r-- 1,415 bytes parent folder | download | duplicates (5)
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
48
49
50
51
<?xml version="1.0" encoding="utf-8"?>

<!-- AUTHOR: Chris Mungall  cjm at fruitfly dot org  -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

  <xsl:output indent="yes" method="xml"/>

  <xsl:key name="k-feature" match="//feature" use="feature_id"/>

  <xsl:template match="/chado">
    <chado>
      <xsl:for-each select="//feature">
        <feature>
          <xsl:copy-of select="*[not(name(.) = 'feature_relationship')]"/>
        </feature>
      </xsl:for-each>
      <xsl:for-each select="//feature_relationship">
        <feature_relationship>
          <subject_id>
            <xsl:apply-templates mode="make-link" select=".."/>
          </subject_id>
          <object_id>
            <xsl:apply-templates mode="make-link" select="object_id/feature"/>
          </object_id>
          <xsl:copy-of select="type_id"/>
        </feature_relationship>
      </xsl:for-each>
    </chado>
  </xsl:template>

  <xsl:template mode="make-link" match="feature">
    <feature>
      <xsl:copy-of select="uniquename"/>
      <xsl:copy-of select="organism_id"/>
      <xsl:copy-of select="type_id"/>
    </feature>
  </xsl:template>

  <!-- block -->
  <xsl:template match="feature_relationship">
  </xsl:template>
  <xsl:template match="feature">
  </xsl:template>

  <xsl:template match="*">
    <xsl:copy-of select="."/>
  </xsl:template>

</xsl:stylesheet>