1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 | <!--<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:java="java" exclude-result-prefixes="java;glidictionary" xmlns:glidictionary="http://xml.apache.org/xalan/java" extension-element-prefixes="glidictionary">-->
|
---|
3 | <xsl:stylesheet
|
---|
4 | version="1.0"
|
---|
5 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
6 | xmlns:dict="http://xml.apache.org/xalan/java/Dictionary"
|
---|
7 | exclude-result-prefixes="dict">
|
---|
8 |
|
---|
9 | <xsl:output method="xml" indent="yes"/>
|
---|
10 |
|
---|
11 | <xsl:template match="Document">
|
---|
12 | <xsl:for-each select="Section[position()>1]">
|
---|
13 | <Subsection id="{@name}">
|
---|
14 | <!--<xsl:attribute name="id">
|
---|
15 | <xsl:call-template name="get-id"><xsl:with-param name="id" select="Title/Text"/></xsl:call-template>
|
---|
16 | </xsl:attribute>-->
|
---|
17 | <xsl:apply-templates select="Title"/>
|
---|
18 | <Content>
|
---|
19 | <xsl:apply-templates select="Title/following-sibling::*"/>
|
---|
20 | </Content>
|
---|
21 | </Subsection>
|
---|
22 | </xsl:for-each>
|
---|
23 | </xsl:template>
|
---|
24 |
|
---|
25 |
|
---|
26 | <xsl:template match="Text"><Text id="gli_{@id}"><xsl:apply-templates/></Text></xsl:template>
|
---|
27 | <xsl:template match="Title"><Title><xsl:apply-templates/></Title></xsl:template>
|
---|
28 |
|
---|
29 | <xsl:template match="Section">
|
---|
30 | <Part id="{@name}">
|
---|
31 | <!--<xsl:attribute name="id">
|
---|
32 | <xsl:call-template name="get-id"><xsl:with-param name="id" select="Title/Text"/></xsl:call-template>
|
---|
33 | </xsl:attribute>-->
|
---|
34 | <xsl:apply-templates select="Title"/>
|
---|
35 | <Content><xsl:apply-templates select="Title/following-sibling::*"/></Content>
|
---|
36 | </Part>
|
---|
37 | </xsl:template>
|
---|
38 |
|
---|
39 | <xsl:template match="AutoText">
|
---|
40 | <xsl:variable name="diction" select="dict:new('en')"/>
|
---|
41 | <xsl:text>"</xsl:text><xsl:choose><xsl:when test="@key"><xsl:value-of select="dict:get($diction, @key, @args)"/></xsl:when><xsl:otherwise><xsl:value-of select="@text"/></xsl:otherwise></xsl:choose><xsl:text>"</xsl:text>
|
---|
42 | </xsl:template>
|
---|
43 |
|
---|
44 | <xsl:template match="Reference">
|
---|
45 | <xsl:variable name="target" select="@target"/>
|
---|
46 | <xsl:text>"</xsl:text><xsl:value-of select="/Document//Section[@name=$target]/Title/Text"/><xsl:text>"</xsl:text>
|
---|
47 | </xsl:template>
|
---|
48 |
|
---|
49 | <!-- generate id for subsections and parts -->
|
---|
50 | <!-- transform the Title(in english) to lower case, replace spaces with '_', and remove "'s" and "/" -->
|
---|
51 | <!--
|
---|
52 | <xsl:template name="get-id">
|
---|
53 | <xsl:param name="id" select="id"/>
|
---|
54 | <xsl:variable name="idnew"><xsl:value-of select="java:lang.String.new($id)"/></xsl:variable>
|
---|
55 | <xsl:variable name="apos">'</xsl:variable>
|
---|
56 | <xsl:variable name="temp"><xsl:value-of select="$apos"/>s</xsl:variable>
|
---|
57 | <xsl:variable name="idnew"><xsl:value-of select="java:replaceAll($idnew, $temp, '')"/></xsl:variable>
|
---|
58 | <xsl:variable name="idnew"><xsl:value-of select="java:replaceAll($idnew, '/', '')"/></xsl:variable>
|
---|
59 | <xsl:value-of select="java:replaceAll(java:toLowerCase($idnew), ' ', '_')"/>
|
---|
60 | </xsl:template>
|
---|
61 | -->
|
---|
62 | </xsl:stylesheet>
|
---|