merge the formfield patch from ooo-build
[ooovba.git] / helpcontent2 / source / auxiliary / embed.xsl
blob3a4e3ef80f61bae4b504aebc1c50244aa6e03338
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"/>
5 <!-- SPECIFY YOUR FILE SYSTEM ROOT PATH TO THE HELP FILES -->
6 <xsl:param name="fsroot" select="'file:///handbuch/WORKBENCH/helpcontent2/source/'"/>
8 <!--
9 ######################################################
10 All others
11 ######################################################
12 -->
13 <xsl:template match="/">
14 <xsl:apply-templates/>
15 </xsl:template>
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>
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>
29 <xsl:template match="bookmark" mode="embedded" />
30 <xsl:template match="ahelp" mode="embedded">
31 <xsl:apply-templates mode="embedded"/>
32 </xsl:template>
34 <xsl:template match="paragraph[@role='heading']">
35 <title>
36 <xsl:apply-templates/>
37 </title>
38 </xsl:template>
40 <xsl:template match="paragraph[@role=*]">
41 <paragraph>
42 <xsl:apply-templates/>
43 </paragraph>
44 </xsl:template>
46 <xsl:template match="sort">
47 <xsl:apply-templates/>
48 </xsl:template>
51 <!--
52 ######################################################
53 EMBED
54 ######################################################
55 -->
56 <xsl:template match="embed">
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>
67 <!--
68 ######################################################
69 EMBEDVAR
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>
80 <!-- FPE: embedvars, that point to "text/shared/00/00000004.xml#wie" will only be resolved in the main_transform -->
82 </xsl:template>
83 </xsl:stylesheet>