xref: /aoo41x/main/xmlhelp/util/embed.xsl (revision cdf0e10c)
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3<xsl:output indent="yes" method="xml"/>
4
5<!-- SPECIFY YOUR FILE SYSTEM ROOT PATH TO THE HELP FILES -->
6<xsl:param name="fsroot" select="'file:///handbuch/WORKBENCH/helpcontent2/source/'"/>
7
8<!--
9######################################################
10All others
11######################################################
12-->
13<xsl:template match="/">
14	<xsl:apply-templates/>
15</xsl:template>
16
17<xsl:template match="*|@*|comment()|processing-instruction()|text()">
18  <xsl:copy>
19    <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"/>
20  </xsl:copy>
21</xsl:template>
22
23<xsl:template match="*|@*|comment()|processing-instruction()|text()" mode="embedded">
24  <xsl:copy>
25    <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()" mode="embedded"/>
26  </xsl:copy>
27</xsl:template>
28
29<xsl:template match="bookmark" mode="embedded" />
30<xsl:template match="ahelp" mode="embedded">
31	<xsl:apply-templates mode="embedded"/>
32</xsl:template>
33
34<xsl:template match="paragraph[@role='heading']">
35    <title>
36        <xsl:apply-templates/>
37    </title>
38</xsl:template>
39
40<xsl:template match="paragraph[@role=*]">
41    <paragraph>
42        <xsl:apply-templates/>
43    </paragraph>
44</xsl:template>
45
46<xsl:template match="sort">
47    <xsl:apply-templates/>
48</xsl:template>
49
50
51<!--
52######################################################
53EMBED
54######################################################
55-->
56<xsl:template match="embed">
57
58		<xsl:variable name="href"><xsl:value-of select="substring-before(concat($fsroot,@href),'#')"/></xsl:variable>
59		<xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
60		<xsl:variable name="doc" select="document($href)"/>
61		<xsl:apply-templates select="$doc//section[@id=$anchor]" mode="embedded"/>
62		<xsl:if test="not($doc//section[@id=$anchor])"> <!-- fallback for embeds that actually should be embedvars -->
63			<paragraph role="paragraph"><xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/></paragraph>
64		</xsl:if>
65</xsl:template>
66
67<!--
68######################################################
69EMBEDVAR
70######################################################
71-->
72<xsl:template match="embedvar">
73	<xsl:if test="not(@href='text/shared/00/00000004.xhp#wie')"> <!-- special treatment if howtoget links -->
74		<xsl:variable name="href"><xsl:value-of select="substring-before(concat($fsroot,@href),'#')"/></xsl:variable>
75		<xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
76		<xsl:variable name="doc" select="document($href)"/>
77		<xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
78	</xsl:if>
79
80	<!-- FPE: embedvars, that point to "text/shared/00/00000004.xml#wie" will only be resolved in the main_transform -->
81
82</xsl:template>
83</xsl:stylesheet>
84