~ubuntu-branches/ubuntu/lucid/gnome-doc-utils/lucid

« back to all changes in this revision

Viewing changes to xslt/docbook/common/db-common.xsl

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-12-19 08:34:21 UTC
  • mto: (2.1.1 etch) (1.1.18 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20051219083421-k72rkh3n6vox1c0t
Tags: upstream-0.5.2
ImportĀ upstreamĀ versionĀ 0.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?xml version='1.0' encoding='utf-8'?><!-- -*- indent-tabs-mode: nil -*- -->
 
1
<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
 
2
<!--
 
3
This program is free software; you can redistribute it and/or modify it under
 
4
the terms of the GNU Lesser General Public License as published by the Free
 
5
Software Foundation; either version 2 of the License, or (at your option) any
 
6
later version.
 
7
 
 
8
This program is distributed in the hope that it will be useful, but WITHOUT
 
9
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
10
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 
11
details.
 
12
 
 
13
You should have received a copy of the GNU Lesser General Public License
 
14
along with this program; see the file COPYING.LGPL.  If not, write to the
 
15
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
16
02111-1307, USA.
 
17
-->
2
18
 
3
19
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
20
                xmlns:doc="http://www.gnome.org/~shaunm/xsldoc"
71
87
<xsl:template name="db.linenumbering">
72
88
  <xsl:param name="node" select="."/>
73
89
  <xsl:param name="number" select="1"/>
74
 
  <xsl:variable name="substr" select="string($node)"/>
75
 
  <xsl:number value="$number"/>
 
90
  <xsl:variable name="substr">
 
91
    <xsl:choose>
 
92
      <xsl:when test="node()[1]/self::text()">
 
93
        <xsl:choose>
 
94
          <!-- CR LF -->
 
95
          <xsl:when test="starts-with(string($node), '&#x000D;&#x000A;')">
 
96
            <xsl:value-of select="substring-after(string($node), '&#x000D;&#x000A;')"/>
 
97
          </xsl:when>
 
98
          <!-- CR -->
 
99
          <xsl:when test="starts-with(string($node), '&#x000D;')">
 
100
            <xsl:value-of select="substring-after(string($node), '&#x000D;')"/>
 
101
          </xsl:when>
 
102
          <!-- LF -->
 
103
          <xsl:when test="starts-with(string($node), '&#x000A;')">
 
104
            <xsl:value-of select="substring-after(string($node), '&#x000A;')"/>
 
105
          </xsl:when>
 
106
          <!-- NEL -->
 
107
          <xsl:when test="starts-with(string($node), '&#x0085;')">
 
108
            <xsl:value-of select="substring-after(string($node), '&#x0085;')"/>
 
109
          </xsl:when>
 
110
          <xsl:otherwise>
 
111
            <xsl:value-of select="string($node)"/>
 
112
          </xsl:otherwise>
 
113
        </xsl:choose>
 
114
      </xsl:when>
 
115
      <xsl:otherwise>
 
116
        <xsl:value-of select="string($node)"/>
 
117
      </xsl:otherwise>
 
118
    </xsl:choose>
 
119
  </xsl:variable>
76
120
  <xsl:call-template name="db.linenumbering.substr">
77
121
    <xsl:with-param name="substr" select="$substr"/>
78
 
    <xsl:with-param name="number" select="$number + 1"/>
 
122
    <xsl:with-param name="number" select="$number"/>
79
123
  </xsl:call-template>
80
124
</xsl:template>
81
125
 
82
126
<xsl:template name="db.linenumbering.substr" doc:private="true">
83
127
  <xsl:param name="substr"/>
84
128
  <xsl:param name="number"/>
85
 
  <xsl:if test="contains($substr, '&#x000A;')">
86
 
    <xsl:text>&#x000A;</xsl:text>
87
 
    <xsl:number value="$number"/>
88
 
    <xsl:call-template name="db.linenumbering.substr">
89
 
      <xsl:with-param name="substr"
90
 
                      select="substring-after($substr, '&#x000A;')"/>
91
 
      <xsl:with-param name="number" select="$number + 1"/>
92
 
    </xsl:call-template>
93
 
  </xsl:if>
 
129
  <xsl:choose>
 
130
    <xsl:when test="contains($substr, '&#x000A;')">
 
131
      <xsl:number value="$number"/>
 
132
      <xsl:text>&#x000A;</xsl:text>
 
133
      <xsl:call-template name="db.linenumbering.substr">
 
134
        <xsl:with-param name="substr"
 
135
                        select="substring-after($substr, '&#x000A;')"/>
 
136
        <xsl:with-param name="number" select="$number + 1"/>
 
137
      </xsl:call-template>
 
138
    </xsl:when>
 
139
    <xsl:when test="string-length($substr) != 0">
 
140
      <xsl:number value="$number"/>
 
141
      <xsl:text>&#x000A;</xsl:text>
 
142
    </xsl:when>
 
143
  </xsl:choose>
94
144
</xsl:template>
95
145
 
96
146
<!-- == db.personname ====================================================== -->