Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="2.0" xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" xmlns:set="http://exslt.org/sets">
3
	<!-- eternal gratitude to stefania -->
4

    
5
	<!--extension-element-prefixes="str set" -->
6
	<output method="text" omit-xml-declaration="yes" />
7
	<template match="/*">
8
		<!--<text>COPY "shadow".context ("id", "name") FROM stdin;&#10;</text> -->
9
		<!-- <text>COPY&#10;</text> -->
10
		<for-each select="//context">
11
            <variable name="id" select="translate(./@id,'&#x0d;&#x0a;^@', '')"  />
12
		<!--	<variable name="id" select="./@id" />-->
13
			<variable name="name" select="./@label" />
14
			<value-of select="$id" />
15
			<text>!</text>
16
            <xsl:value-of select="$name"/>
17
			<text>!&#10;</text>
18
		</for-each>
19

    
20
		<!--<text>COPY "shadow".category ("id", "name", "context") FROM stdin;&#10;</text> -->
21
		<text>COPY&#10;</text>
22
		<for-each select="//context">
23
			<!--<variable name="contextid" select="./@id" />-->
24
            <variable name="contextid" select="translate(./@id,'&#x0d;&#x0a;', '')"  />
25

    
26
			<for-each select="./category">
27
				<variable name="id" select="./@id" />
28
				<variable name="name" select="./@label" />
29
				<value-of select="$id" />
30
				<text>!</text>
31
                <xsl:value-of select="translate($name,'&#x0d;&#x0a;', '')" />
32
				<text>!</text>
33
                <xsl:value-of select="translate($contextid,'&#x0d;&#x0a;', '')" />
34
			 <text>!&#10;</text>
35
			</for-each>
36
		</for-each>
37
		<!--<text>COPY "shadow".concept ("id", "name", "category") FROM stdin;&#10;</text> -->
38
		<text>COPY&#10;</text>
39
		<for-each select="//context">
40
			<for-each select="./category">
41
				<variable name="categoryid" select="./@id" />
42
				<for-each select=".//concept">
43
                     	          <variable name="id" select="./@id" />
44
					<variable name="name" select="./@label" />
45
                			<value-of select="$id" />
46
					<text>!</text>
47
				     <xsl:value-of select="translate($name,'&#x0d;&#x0a;', '')" />
48
					<text>!</text>
49
					<value-of select="$categoryid" />
50
					<text>!&#10;</text>
51
				</for-each>
52
			</for-each>
53
		</for-each>
54
	</template>
55
</xsl:stylesheet>
(2-2/4)