- Timestamp:
- Mar 5, 2011, 7:35:51 PM (14 years ago)
- Children:
- 5508d22
- Parents:
- d17cfb8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BOOK/stylesheets/clfs-profile.xsl
rd17cfb8 r4a39252 15 15 <xsl:param name="clfs.arch" select="''" /> 16 16 <xsl:param name="clfs.multilib" select="''" /> 17 17 18 18 <!-- Apply the other templates --> 19 19 <xsl:template match="@*|node()" priority="-1"> … … 23 23 </xsl:template> 24 24 25 <!-- Build the package xml --> 25 26 <xsl:template match="//c:package"> 26 27 <xsl:param name="id" select="@id" /> … … 77 78 78 79 <xsl:for-each select="sect1"> 80 79 81 <xsl:copy> 80 82 <xsl:attribute name="id"> 81 83 <xsl:value-of select="concat($id, $idsuffix)" /> 84 </xsl:attribute> 85 <xsl:attribute name="role"> 86 <xsl:text>package</xsl:text> 82 87 </xsl:attribute> 83 88 <xsl:processing-instruction name="dbhtml"> … … 86 91 <xsl:text>.html"</xsl:text> 87 92 </xsl:processing-instruction> 88 <xsl:apply-templates select="child::node()[(string-length(@c:bits) = 0) or contains(concat(',',@c:bits,','), concat(',', $bits, ','))]" /> 93 <xsl:choose> 94 <xsl:when test="$bits = '32'"> 95 <xsl:apply-templates select="@*|node()" mode="filter-bits-32" /> 96 </xsl:when> 97 <xsl:when test="$bits = 'n32'"> 98 <xsl:apply-templates select="@*|node()" mode="filter-bits-n32" /> 99 </xsl:when> 100 <xsl:when test="$bits = '64'"> 101 <xsl:apply-templates select="@*|node()" mode="filter-bits-64" /> 102 </xsl:when> 103 </xsl:choose> 89 104 </xsl:copy> 90 105 </xsl:for-each> 91 106 </xsl:template> 92 107 93 <!-- Apply the build profile filter --> 94 108 <!-- Apply the profile to the 32bit package --> 109 110 <xsl:template match="@*|node()" mode="filter-bits-32"> 111 <xsl:variable name="ismultilib"> 112 <xsl:choose> 113 <xsl:when test="contains($clfs.multilib, ',')"> 114 <xsl:text>true</xsl:text> 115 </xsl:when> 116 <xsl:otherwise> 117 <xsl:text>false</xsl:text> 118 </xsl:otherwise> 119 </xsl:choose> 120 </xsl:variable> 121 <xsl:if test="(string-length(@c:arch) = 0) or contains(concat(',',@c:arch,','), concat(',', $clfs.arch, ','))"> 122 <xsl:if test="(string-length(@c:multilib) = 0) or contains(concat(',',@c:multilib,','), concat(',', $ismultilib, ','))"> 123 <xsl:if test="(string-length(@c:bits) = 0) or contains(concat(',',@c:bits,','), ',32,')"> 124 <xsl:copy> 125 <xsl:apply-templates select="@*|node()" mode="filter-bits-32" /> 126 </xsl:copy> 127 </xsl:if> 128 </xsl:if> 129 </xsl:if> 130 </xsl:template> 131 132 <xsl:template match="@c:arch" mode="filter-bits-32" /> 133 <xsl:template match="@c:bits" mode="filter-bits-32" /> 134 <xsl:template match="@c:multilib" mode="filter-bits-32" /> 135 136 <!-- Apply the profile to the n32 package --> 137 138 <xsl:template match="@*|node()" mode="filter-bits-n32"> 139 <xsl:variable name="ismultilib"> 140 <xsl:choose> 141 <xsl:when test="contains($clfs.multilib, ',')"> 142 <xsl:text>true</xsl:text> 143 </xsl:when> 144 <xsl:otherwise> 145 <xsl:text>false</xsl:text> 146 </xsl:otherwise> 147 </xsl:choose> 148 </xsl:variable> 149 <xsl:if test="(string-length(@c:arch) = 0) or contains(concat(',',@c:arch,','), concat(',', $clfs.arch, ','))"> 150 <xsl:if test="(string-length(@c:multilib) = 0) or contains(concat(',',@c:multilib,','), concat(',', $ismultilib, ','))"> 151 <xsl:if test="(string-length(@c:bits) = 0) or contains(concat(',',@c:bits,','), ',n32,')"> 152 <xsl:copy> 153 <xsl:apply-templates select="@*|node()" mode="filter-bits-n32" /> 154 </xsl:copy> 155 </xsl:if> 156 </xsl:if> 157 </xsl:if> 158 </xsl:template> 159 160 <xsl:template match="@c:arch" mode="filter-bits-n32" /> 161 <xsl:template match="@c:bits" mode="filter-bits-n32" /> 162 <xsl:template match="@c:multilib" mode="filter-bits-n32" /> 163 164 <!-- Apply the profile to the 64bit package --> 165 166 <xsl:template match="@*|node()" mode="filter-bits-64"> 167 <xsl:variable name="ismultilib"> 168 <xsl:choose> 169 <xsl:when test="contains($clfs.multilib, ',')"> 170 <xsl:text>true</xsl:text> 171 </xsl:when> 172 <xsl:otherwise> 173 <xsl:text>false</xsl:text> 174 </xsl:otherwise> 175 </xsl:choose> 176 </xsl:variable> 177 <xsl:if test="(string-length(@c:arch) = 0) or contains(concat(',',@c:arch,','), concat(',', $clfs.arch, ','))"> 178 <xsl:if test="(string-length(@c:multilib) = 0) or contains(concat(',',@c:multilib,','), concat(',', $ismultilib, ','))"> 179 <xsl:if test="(string-length(@c:bits) = 0) or contains(concat(',',@c:bits,','), ',64,')"> 180 <xsl:copy> 181 <xsl:apply-templates select="@*|node()" mode="filter-bits-64" /> 182 </xsl:copy> 183 </xsl:if> 184 </xsl:if> 185 </xsl:if> 186 </xsl:template> 187 188 <xsl:template match="@c:arch" mode="filter-bits-64" /> 189 <xsl:template match="@c:bits" mode="filter-bits-64" /> 190 <xsl:template match="@c:multilib" mode="filter-bits-64" /> 191 192 <!-- Apply the profile filter to the entire document --> 95 193 <xsl:template match="//*[@c:arch]|//*[@c:multilib]"> 96 194 <xsl:variable name="ismultilib"> … … 107 205 <xsl:if test="(string-length(@c:multilib) = 0) or contains(concat(',',@c:multilib,','), concat(',', $ismultilib, ','))"> 108 206 <xsl:copy> 109 <xsl:apply-templates select="@*|node()" />207 <xsl:apply-templates select="@*|node()" /> 110 208 </xsl:copy> 111 209 </xsl:if> … … 113 211 </xsl:template> 114 212 115 <!-- Remove the profiling attributes specific to this stylesheet --> 116 213 <!-- Remove the profileing attributes for the remaining objects --> 117 214 <xsl:template match="@c:arch" /> 118 215 <xsl:template match="@c:bits" />
Note:
See TracChangeset
for help on using the changeset viewer.