This repository was archived by the owner on Mar 29, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocsent-post.xsl
More file actions
66 lines (56 loc) · 1.9 KB
/
Copy pathdocsent-post.xsl
File metadata and controls
66 lines (56 loc) · 1.9 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="UTF-8" indent="yes" cdata-section-elements="HEADLINE S" />
<xsl:template match="/Thread">
<DOCSENT>
<xsl:attribute name="DID">
<xsl:value-of select="ThreadID"/>
</xsl:attribute>
<BODY>
<HEADLINE>
<S>
<xsl:attribute name="PAR">1</xsl:attribute>
<xsl:attribute name="RSNT">1</xsl:attribute>
<xsl:attribute name="SNO">1</xsl:attribute>
<xsl:value-of select="Title" />
</S>
</HEADLINE>
<TEXT>
<xsl:apply-templates select="InitPost" />
<xsl:apply-templates select="Post" />
</TEXT>
</BODY>
</DOCSENT>
</xsl:template>
<xsl:template match="Post | InitPost">
<S>
<xsl:attribute name="PAR">
<xsl:number count="Post|InitPost" value="position() + 1" format="1" />
</xsl:attribute>
<xsl:attribute name="RSNT">1</xsl:attribute>
<xsl:attribute name="SNO">
<xsl:number count="Post|InitPost" value="position() + 1" format="1" />
</xsl:attribute>
<xsl:attribute name="UserID">
<xsl:value-of select="UserID" />
</xsl:attribute>
<xsl:attribute name="Class">
<xsl:value-of select="Class" />
</xsl:attribute>
<xsl:call-template name="join">
<xsl:with-param name="list" select="Sentence/SText" />
<xsl:with-param name="separator" select="' '" />
</xsl:call-template>
</S>
</xsl:template>
<xsl:template name="join">
<xsl:param name="list" />
<xsl:param name="separator" />
<xsl:for-each select="$list">
<xsl:value-of select="." />
<xsl:if test="position() != last()">
<xsl:value-of select="$separator" />
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>