xref: /aoo41x/main/xmlhelp/util/embed.xsl (revision 10544477)
1<?xml version="1.0" encoding="UTF-8"?>
2<!--***********************************************************
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements.  See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership.  The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License.  You may obtain a copy of the License at
11 *
12 *   http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied.  See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 *
21 ***********************************************************-->
22<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
23<xsl:output indent="yes" method="xml"/>
24
25<!-- SPECIFY YOUR FILE SYSTEM ROOT PATH TO THE HELP FILES -->
26<xsl:param name="fsroot" select="'file:///handbuch/WORKBENCH/helpcontent2/source/'"/>
27
28<!--
29######################################################
30All others
31######################################################
32-->
33<xsl:template match="/">
34	<xsl:apply-templates/>
35</xsl:template>
36
37<xsl:template match="*|@*|comment()|processing-instruction()|text()">
38  <xsl:copy>
39    <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"/>
40  </xsl:copy>
41</xsl:template>
42
43<xsl:template match="*|@*|comment()|processing-instruction()|text()" mode="embedded">
44  <xsl:copy>
45    <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()" mode="embedded"/>
46  </xsl:copy>
47</xsl:template>
48
49<xsl:template match="bookmark" mode="embedded" />
50<xsl:template match="ahelp" mode="embedded">
51	<xsl:apply-templates mode="embedded"/>
52</xsl:template>
53
54<xsl:template match="paragraph[@role='heading']">
55    <title>
56        <xsl:apply-templates/>
57    </title>
58</xsl:template>
59
60<xsl:template match="paragraph[@role=*]">
61    <paragraph>
62        <xsl:apply-templates/>
63    </paragraph>
64</xsl:template>
65
66<xsl:template match="sort">
67    <xsl:apply-templates/>
68</xsl:template>
69
70
71<!--
72######################################################
73EMBED
74######################################################
75-->
76<xsl:template match="embed">
77
78		<xsl:variable name="href"><xsl:value-of select="substring-before(concat($fsroot,@href),'#')"/></xsl:variable>
79		<xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
80		<xsl:variable name="doc" select="document($href)"/>
81		<xsl:apply-templates select="$doc//section[@id=$anchor]" mode="embedded"/>
82		<xsl:if test="not($doc//section[@id=$anchor])"> <!-- fallback for embeds that actually should be embedvars -->
83			<paragraph role="paragraph"><xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/></paragraph>
84		</xsl:if>
85</xsl:template>
86
87<!--
88######################################################
89EMBEDVAR
90######################################################
91-->
92<xsl:template match="embedvar">
93	<xsl:if test="not(@href='text/shared/00/00000004.xhp#wie')"> <!-- special treatment if howtoget links -->
94		<xsl:variable name="href"><xsl:value-of select="substring-before(concat($fsroot,@href),'#')"/></xsl:variable>
95		<xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
96		<xsl:variable name="doc" select="document($href)"/>
97		<xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
98	</xsl:if>
99
100	<!-- FPE: embedvars, that point to "text/shared/00/00000004.xml#wie" will only be resolved in the main_transform -->
101
102</xsl:template>
103</xsl:stylesheet>
104