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