[Libreoffice-commits] dev-tools.git: helpauthoring/filter

Regina Henschel rb.henschel at t-online.de
Mon Oct 19 23:23:49 PDT 2015


 helpauthoring/filter/xmlhelp2soffice.xsl |   33 +++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

New commits:
commit 1d020c732782085c99c166bd3b4bd583360c277e
Author: Regina Henschel <rb.henschel at t-online.de>
Date:   Mon Oct 5 18:22:33 2015 +0200

    tdf#93981 Attribute localize=(false|true) is deleted
    
    The information localize='false' is tracked by adding _NOL10N to
    the paragraph id. But some files exist, where the paragraph does not
    have an id at all. In such cases an id is created, as an id is
    a required attribute. This solves tdf#94612 partly, because a
    missing id in a file would otherwise generate an empty id on import,
    which is neither allowed.
    
    Change-Id: Ib136493dee004fd09f8e7e14d05c99ea173865e0
    Reviewed-on: https://gerrit.libreoffice.org/19166
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
    Tested-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/helpauthoring/filter/xmlhelp2soffice.xsl b/helpauthoring/filter/xmlhelp2soffice.xsl
index a8584ed..fdb3f43 100644
--- a/helpauthoring/filter/xmlhelp2soffice.xsl
+++ b/helpauthoring/filter/xmlhelp2soffice.xsl
@@ -938,15 +938,25 @@ PARAGRAPH
                         </xsl:choose>
                     </xsl:variable>
 
+                    <xsl:variable name="idhdvalue">
+                    <xsl:choose>
+                        <xsl:when test="@id and not(@id='')">
+                            <xsl:value-of select="@id"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:value-of select="concat('hd_',generate-id())"/> <!-- there exists files with paragraphs without id -->
+                        </xsl:otherwise>
+                    </xsl:choose>
+                    </xsl:variable>
 
                     <text:span text:style-name="{$tagstyle}">
                         <text:variable-set text:name="ID" text:value-type="string" text:display="value">
                             <xsl:choose>
-                                <xsl:when test="@xml-lang">
-                                    <xsl:value-of select="@id"/>
+                                <xsl:when test="@localize='false'">
+                                    <xsl:value-of select="concat($idhdvalue,'_NOL10N')"/>
                                 </xsl:when>
                                 <xsl:otherwise>
-                                    <xsl:value-of select="concat(@id,'_NOL10N')"/>
+                                    <xsl:value-of select="$idhdvalue"/>
                                 </xsl:otherwise>
                             </xsl:choose>
                             <!--
@@ -981,14 +991,25 @@ PARAGRAPH
                         </xsl:choose>
                     </xsl:variable>
 
+                    <xsl:variable name="idparvalue">
+                        <xsl:choose>
+                            <xsl:when test="@id and not(@id='')">
+                                <xsl:value-of select="@id"/>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:value-of select="concat('par_',generate-id())"/> <!-- there exists files with paragraphs without id -->
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:variable>
+
                     <text:span text:style-name="{$tagstyle}">
                         <text:variable-set text:name="ID" text:value-type="string" text:display="value">
                         <xsl:choose>
-                                <xsl:when test="@xml-lang">
-                                    <xsl:value-of select="@id"/>
+                                <xsl:when test="@localize='false'">
+                                    <xsl:value-of select="concat($idparvalue,'_NOL10N')"/>
                                 </xsl:when>
                                 <xsl:otherwise>
-                                    <xsl:value-of select="concat(@id,'_NOL10N')"/>
+                                    <xsl:value-of select="$idparvalue"/>
                                 </xsl:otherwise>
                             </xsl:choose>
                         <!--


More information about the Libreoffice-commits mailing list