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