Changeset 8872 for trunk/Wsp_Modeling/spaces/gen/modelBuilder/bs.doss/sm_odTemplateText/postProcessing.xsl.xsl
- Timestamp:
- 03/05/07 19:29:23 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Wsp_Modeling/spaces/gen/modelBuilder/bs.doss/sm_odTemplateText/postProcessing.xsl.xsl
r8704 r8872 40 40 # <scOd:data>odContent</scOd:data> 41 41 # </scOd:dataBlock> 42 # <scOd:showDataBlocks category="xxx" hideEmptyBlocks="yes|no" hideIfNoBlocks="yes|no" >42 # <scOd:showDataBlocks category="xxx" hideEmptyBlocks="yes|no" hideIfNoBlocks="yes|no" hideBlockIfShowInContent="yes|no"> 43 43 # <scOd:forEachBlock> 44 44 # odContent … … 186 186 <xsl:param name="pCateg"/> 187 187 <xsl:param name="pIdForEach"/> 188 <xsl:param name="pMode"/><!-- [|ignoreAlreadyShowBlocks] --> 188 189 <xsl:for-each select="//scOd:dataBlockDeclaration[@category=$pCateg]"> 189 190 <blocks category="{{$pCateg}}"> 190 <documentBlockList ><!-- liste des dataBlock tels que déclarés -->191 <documentBlockList firstShowDbId="{{generate-id(//scOd:showDataBlocks[@category=$pCateg][1]//scOd:forEachBlock[1])}}"><!-- liste des dataBlock tels que déclarés --> 191 192 <xsl:apply-templates select="//scOd:dataBlock[@category=$pCateg]" mode="getDataBlockList"/> 192 193 </documentBlockList> … … 195 196 <xsl:apply-templates select="//scOd:dataBlock[@category=$pCateg]" mode="getBlockDef"> 196 197 <xsl:with-param name="pIdForEach" select="$pIdForEach"/> 198 <xsl:with-param name="pMode" select="$pMode"/> 197 199 <xsl:sort select="normalize-space(scOd:sortKey)" data-type="text" order="{{key('dataBlockDeclaration', @category)/@sort}}"/> 198 200 </xsl:apply-templates> … … 201 203 <xsl:apply-templates select="//scOd:dataBlock[@category=$pCateg]" mode="getBlockDef"> 202 204 <xsl:with-param name="pIdForEach" select="$pIdForEach"/> 205 <xsl:with-param name="pMode" select="$pMode"/> 203 206 </xsl:apply-templates> 204 207 </xsl:otherwise> … … 209 212 210 213 <xsl:template match="scOd:dataBlock" mode="getDataBlockList"> 211 <dataBlock refId="{{generate-id()}}" category="{{@category}}" blockId="{{normalize-space(scOd:id)}}"/> 214 <xsl:variable name="vId" select="normalize-space(scOd:id)"/> 215 <xsl:variable name="vCategory" select="@category"/> 216 <xsl:variable name="vIsContentShowInDocument"><!-- Permet de dire si la partie "contenu" de ce block a été affichée qq part dans le document --> 217 <xsl:choose> 218 <xsl:when test="scOd:overrideContentDeclaration and scOd:overrideContentDeclaration//scOd:block.data">true</xsl:when> 219 <xsl:when test="key('dataBlockDeclaration', @category)/scOd:content//scOd:block.data or key('dataBlockDeclaration', @category)/scOd:conditionalContent//scOd:block.data">true</xsl:when> 220 <xsl:otherwise>false</xsl:otherwise> 221 </xsl:choose> 222 </xsl:variable> 223 <dataBlock refId="{{generate-id()}}" category="{{@category}}" blockId="{{normalize-space(scOd:id)}}" isContentShowInDocument="{{normalize-space($vIsContentShowInDocument)}}"/> 212 224 </xsl:template> 213 225 214 226 <xsl:template match="scOd:dataBlock" mode="getBlockDef"> 215 227 <xsl:param name="pIdForEach"/> 228 <xsl:param name="pMode"/><!-- [|ignoreAlreadyShowBlocks] --> 216 229 <xsl:variable name="vId" select="normalize-space(scOd:id)"/> 217 230 <xsl:variable name="vCategory" select="@category"/> … … 227 240 </xsl:variable> 228 241 <xsl:variable name="vData"><xsl:copy-of select="scOd:data/* | scOd:data/text()"/></xsl:variable> 242 <xsl:variable name="vHasData" select="string-length(normalize-space($vData))>0"/> 229 243 <xsl:variable name="vIsContentShowInDocument"><!-- Permet de dire si la partie "contenu" de ce block a été affichée qq part dans le document --> 230 244 <xsl:choose> 231 <xsl:when test="key('dataBlockDeclaration', @category)/scOd:content or key('dataBlockDeclaration', @category)/scOd:conditionalContent">true</xsl:when>232 <xsl:when test=" key('dataBlockDeclaration', @category)/scOd:noContent and count(//scOd:dataBlock[normalize-space(scOd:id)=$vId and @category=$vCategory and scOd:overrideContentDeclaration])>0">true</xsl:when>245 <xsl:when test="key('dataBlockDeclaration', @category)/scOd:content//scOd:block.data or key('dataBlockDeclaration', @category)/scOd:conditionalContent//scOd:block.data">true</xsl:when> 246 <xsl:when test="count(//scOd:dataBlock[normalize-space(scOd:id)=$vId and @category=$vCategory and scOd:overrideContentDeclaration//scOd:block.data])>0">true</xsl:when> 233 247 <xsl:otherwise>false</xsl:otherwise> 234 248 </xsl:choose> 235 249 </xsl:variable> 236 <xsl:if test="(key('dataBlockDeclaration', @category)/@hideEmptyBlocks='true' and count(normalize-space($vData))=0) or key('dataBlockDeclaration', @category)/@hideSameBlock='no' or string-length(normalize-space(scOd:sortKey))=0 or not(preceding::scOd:dataBlock[@category=$vCategory and normalize-space(scOd:id)=$vId])"><!-- si block déja pris en compte et élimination des doublons activée et sortKey renseigné => on ne prend pas le block--> 237 <block idList="{{normalize-space($vIdBlockList)}}" category="{{@category}}" sortKey="{{normalize-space(scOd:sortKey)}}" idBlock="{{normalize-space(scOd:id)}}" isContentShowInDocument="{{normalize-space($vIsContentShowInDocument)}}"><!-- TODO : isContentShowInDocument à exploiter dans showDataBlock. Mettre une option pour n'afficher que les blocks qui n'ont pas été matérialisés dans le document --> 238 <title><xsl:copy-of select="scOd:title/* | scOd:title/text()"/></title> 239 <data><xsl:copy-of select="$vData"/></data> 240 <declaration><xsl:copy-of select="key('dataBlockDeclaration', @category)/* | key('dataBlockDeclaration', @category)/text()"/></declaration> 241 <xsl:if test="string-length(normalize-space($pIdForEach))>0"> 242 <definition><xsl:copy-of select="key('forEachBlock', $pIdForEach)/*"/></definition> 243 </xsl:if> 244 </block> 250 <xsl:if test="$pMode!='ignoreAlreadyShowBlocks' or key('dataBlockDeclaration', @category)/@hideBlockIfShowInContent='no' or (key('dataBlockDeclaration', @category)/@hideBlockIfShowInContent='yes' and normalize-space($vIsContentShowInDocument)='false')"> 251 <xsl:if test=" not(key('dataBlockDeclaration', @category)/@hideEmptyBlocks='yes' 252 and not($vHasData)) and not(key('dataBlockDeclaration', @category)/@hideSameBlock='yes' and string-length(normalize-space(scOd:id))!=0 and preceding::scOd:dataBlock[@category=$vCategory and normalize-space(scOd:id)=$vId] and preceding::scOd:dataBlock[@category=$vCategory and normalize-space(scOd:id)=$vId]/scOd:data=$vData)"><!-- si block vide OU déja pris en compte => on ne prend pas le block--> 253 <block idList="{{normalize-space($vIdBlockList)}}" category="{{@category}}" sortKey="{{normalize-space(scOd:sortKey)}}" idBlock="{{normalize-space(scOd:id)}}" isContentShowInDocument="{{normalize-space($vIsContentShowInDocument)}}"> 254 <title><xsl:copy-of select="scOd:title/* | scOd:title/text()"/></title> 255 <data><xsl:copy-of select="$vData"/></data> 256 <declaration><xsl:copy-of select="key('dataBlockDeclaration', @category)/* | key('dataBlockDeclaration', @category)/text()"/></declaration> 257 <xsl:if test="string-length(normalize-space($pIdForEach))>0"> 258 <definition><xsl:copy-of select="key('forEachBlock', $pIdForEach)/*"/></definition> 259 </xsl:if> 260 </block> 261 </xsl:if> 245 262 </xsl:if> 246 263 </xsl:template> … … 293 310 <xsl:with-param name="pCateg" select="$vCateg"/> 294 311 <xsl:with-param name="pIdForEach" select="generate-id()"/> 312 <xsl:with-param name="pMode">ignoreAlreadyShowBlocks</xsl:with-param><!-- On n'affiche pas les blocks déja pris en compte dans le contenu --> 295 313 </xsl:call-template> 296 314 </xsl:variable> … … 305 323 <xsl:variable name="vCateg" select="ancestor-or-self::scOd:showDataBlocks/@category"/> 306 324 <xsl:variable name="vBlockList"> 307 <xsl:call-template name="getDataBlockList"> 308 <xsl:with-param name="pCateg" select="$vCateg"/> 309 <xsl:with-param name="pIdForEach" select="generate-id()"/> 310 </xsl:call-template> 311 </xsl:variable> 312 <xsl:apply-templates select="xalan:nodeset($vBlockList)" mode="definition"/> 313 </xsl:template> 314 315 <xsl:template match="blocks" mode="definition"><xsl:apply-templates mode="definition"/></xsl:template> 316 <xsl:template match="block" mode="definition"><xsl:apply-templates select="definition/* | definition/text()"/></xsl:template> 325 <root showDataBlockId="{{generate-id()}}"> 326 <xsl:call-template name="getDataBlockList"> 327 <xsl:with-param name="pCateg" select="$vCateg"/> 328 <xsl:with-param name="pIdForEach" select="generate-id()"/> 329 <xsl:with-param name="pMode">ignoreAlreadyShowBlocks</xsl:with-param><!-- On n'affiche pas les blocks déja pris en compte dans le contenu --> 330 </xsl:call-template> 331 </root> 332 </xsl:variable> 333 <xsl:apply-templates select="xalan:nodeset($vBlockList)/root/*" mode="definition"/> 334 </xsl:template> 335 336 <xsl:template match="blocks" mode="definition"> 337 <xsl:apply-templates mode="definition"/> 338 </xsl:template> 339 <xsl:template match="block" mode="definition"> 340 <xsl:apply-templates select="definition/* | definition/text()"/> 341 </xsl:template> 317 342 318 343 <xsl:template match="scOd:refBlock"> … … 321 346 <xsl:variable name="vCategory" select="$vBlock/@category"/> 322 347 <xsl:variable name="vIdBlock" select="normalize-space($vBlock/@idBlock)"/> 348 349 <xsl:variable name="vFirstCall" select="$vDataBlockList/dataBlock[@category=$vCategory and @blockId=$vIdBlock][1]/@refId"/> 350 <xsl:variable name="vFirstCallData" select="$vDataBlockList/dataBlock[@category=$vCategory and @blockId=$vIdBlock and @isContentShowInDocument='true'][1]/@refId"/> 351 <xsl:variable name="vFirstShowDbCall" select="concat($vDataBlockList/@firstShowDbId,$vIdBlock)"/> 352 323 353 <xsl:variable name="vRefBlockId"> 324 354 <xsl:choose> 325 <xsl:when test="@position='first'"><xsl:value-of select="$vDataBlockList/dataBlock[@category=$vCategory and @blockId=$vIdBlock][1]/@refId"/></xsl:when> 355 <xsl:when test="@position='first'"><xsl:value-of select="$vDataBlockList"/></xsl:when> 356 <xsl:when test="@position='firstCallData' and $vFirstCallData"><xsl:value-of select="$vFirstCallData"/></xsl:when> 357 <xsl:when test="@position='firstCallData' and $vFirstShowDbCall"><xsl:value-of select="$vFirstShowDbCall"/></xsl:when> 358 <xsl:when test="@position='firstCallData'"><xsl:value-of select="$vDataBlockList"/></xsl:when> 326 359 </xsl:choose> 327 360 </xsl:variable> … … 330 363 331 364 <xsl:template match="scOd:block.data"> 332 <xsl:variable name="vBlock" select="ancestor::block"/> 333 <xsl:apply-templates select="$vBlock/data/* | $vBlock/data/text()"/> 334 </xsl:template> 335 336 <xsl:template match="scOd:block.label"><xsl:variable name="vBlock" select="ancestor::block"/><xsl:value-of select="$vBlock/title"/></xsl:template> 365 <xsl:choose> 366 <xsl:when test="ancestor::block"><!-- on est dans le contexte d'un showDataBlock --> 367 <xsl:variable name="vBlock" select="ancestor::block"/> 368 <xsl:variable name="vShowDbId" select="ancestor::root/@showDataBlockId"/> 369 <text:p text:style-name="odHiddenParagraph"><text:bookmark-start text:name="{{concat($vShowDbId, $vBlock/@idBlock)}}"/><scOd:notIfText/></text:p> 370 <xsl:apply-templates select="$vBlock/data/* | $vBlock/data/text()"/> 371 <text:p text:style-name="odHiddenParagraph"><text:bookmark-end text:name="{{concat($vShowDbId, $vBlock/@idBlock)}}"/><scOd:notIfText/></text:p> 372 </xsl:when> 373 <xsl:otherwise> 374 <xsl:variable name="vBlock" select="ancestor::scOd:dataBlock"/> 375 <xsl:apply-templates select="$vBlock/scOd:data/* | $vBlock/scOd:data/text()"/> 376 </xsl:otherwise> 377 </xsl:choose> 378 </xsl:template> 379 380 <xsl:template match="scOd:block.label"> 381 <xsl:choose> 382 <xsl:when test="ancestor::block"> 383 <xsl:variable name="vBlock" select="ancestor::block"/> 384 <xsl:value-of select="$vBlock/title"/> 385 </xsl:when> 386 <xsl:otherwise> 387 <xsl:variable name="vBlock" select="ancestor::scOd:dataBlock"/> 388 <xsl:value-of select="$vBlock/scOd:title"/> 389 </xsl:otherwise> 390 </xsl:choose> 391 </xsl:template> 337 392 <xsl:template match="scOd:block.position"><xsl:for-each select="ancestor::block[1]"><xsl:value-of select="count(preceding-sibling::block)+1"/></xsl:for-each></xsl:template> 338 393 <xsl:template match="scOd:callBlockPages">
Note: See TracChangeset
for help on using the changeset viewer.