Fixes #3952.
[librarian.git] / librarian / pdf / wl2tex.xslt
index 6c60125..8a1eb08 100644 (file)
 </xsl:template>
 
 <xsl:template match="rdf:RDF" mode="dctitle">
-    <cmd name="autorpodutworu">
-        <parm><xsl:call-template name="authors" /></parm>
-    </cmd>
-    <cmd name="nazwapodutworu"><parm>
+    <xsl:if test="../../rdf:RDF//use_subauthor">
+        <cmd name="autorpodutworu">
+            <parm><xsl:call-template name="authors" /></parm>
+        </cmd>
+    </xsl:if>
+    <cmd name="nazwanadpodutworu"><parm>
+        <xsl:apply-templates select=".//dc:title/node()" mode="inline" />
+    </parm>
+    <parm>
         <xsl:apply-templates select=".//dc:title/node()" mode="inline" />
     </parm></cmd>
 </xsl:template>
     <cmd name="nazwapodutworu">
         <parm><xsl:apply-templates mode="inline"/></parm>
         <parm>
-            <xsl:for-each select="./text() | nbsp | dywiz | alien">
-                <xsl:choose>
-                    <xsl:when test="name() = 'nbsp'">
-                        <xsl:text> </xsl:text>
-                    </xsl:when>
-                    <xsl:when test="name() = 'dywiz'">
-                        <xsl:text>-</xsl:text>
-                    </xsl:when>
-                    <xsl:when test="name() = 'alien'">
-                        <xsl:apply-templates mode="inline" />
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:value-of select="."/>
-                    </xsl:otherwise>
-                </xsl:choose>
-            </xsl:for-each>
+            <xsl:call-template name="strip-for-toc" />
         </parm>
     </cmd>
 </xsl:template>
 
 
 <xsl:template
-    match="naglowek_osoba|naglowek_podrozdzial|miejsce_czas|didaskalia|lista_osoba|akap|akap_diafrlog|akap_cd|motto_podpis|naglowek_listy|srodtytul">
+    match="naglowek_osoba|naglowek_podrozdzial|miejsce_czas|didaskalia|lista_osoba|akap|akap_dialog|akap_cd|motto_podpis|naglowek_listy|srodtytul">
     <cmd>
         <xsl:attribute name="name">
             <xsl:value-of select="wl:texcommand(name())" />
         </xsl:attribute>
         <parm><xsl:apply-templates mode="inline"/></parm>
         <parm>
-            <xsl:for-each select="./text()">
-                <xsl:value-of select="."/>
-            </xsl:for-each>
+            <xsl:call-template name="strip-for-toc" />
         </parm>
     </cmd>
 </xsl:template>
     </xsl:if>
 </xsl:template>
 
+<xsl:template name="strip-for-toc">
+    <xsl:for-each select="./text() | nbsp | dywiz | alien | slowo_obce">
+        <xsl:choose>
+            <xsl:when test="name() = 'nbsp'">
+                <xsl:text> </xsl:text>
+            </xsl:when>
+            <xsl:when test="name() = 'dywiz'">
+                <xsl:text>-</xsl:text>
+            </xsl:when>
+            <xsl:when test="name() = 'alien'">
+                <xsl:apply-templates mode="inline" />
+            </xsl:when>
+            <xsl:when test="name() = 'slowo_obce'">
+                <xsl:call-template name="strip-for-toc" />
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="."/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:for-each>
+</xsl:template>
+
 <xsl:template match="data-sponsor" mode="sponsor">
     <cmd name="par"><parm>
     <xsl:choose>