Ignore:
Timestamp:
03/05/07 19:29:23 (5 years ago)
Author:
anp
Message:

débug dataBlock

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Wsp_Modeling/spaces/gen/modelBuilder/bs.doss/sm_odTemplateText/postProcessing.xsl.xsl

    r8704 r8872  
    4040                #                                       <scOd:data>odContent</scOd:data> 
    4141                #                         </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"> 
    4343                #                <scOd:forEachBlock> 
    4444                #                       odContent 
     
    186186                        <xsl:param name="pCateg"/> 
    187187                        <xsl:param name="pIdForEach"/> 
     188                        <xsl:param name="pMode"/><!-- [|ignoreAlreadyShowBlocks] --> 
    188189                        <xsl:for-each select="//scOd:dataBlockDeclaration[@category=$pCateg]"> 
    189190                                <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 --> 
    191192                                                <xsl:apply-templates select="//scOd:dataBlock[@category=$pCateg]" mode="getDataBlockList"/> 
    192193                                        </documentBlockList> 
     
    195196                                                        <xsl:apply-templates select="//scOd:dataBlock[@category=$pCateg]" mode="getBlockDef"> 
    196197                                                                <xsl:with-param name="pIdForEach" select="$pIdForEach"/> 
     198                                                                <xsl:with-param name="pMode" select="$pMode"/> 
    197199                                                                <xsl:sort select="normalize-space(scOd:sortKey)" data-type="text" order="{{key('dataBlockDeclaration', @category)/@sort}}"/> 
    198200                                                        </xsl:apply-templates> 
     
    201203                                                        <xsl:apply-templates select="//scOd:dataBlock[@category=$pCateg]" mode="getBlockDef"> 
    202204                                                                <xsl:with-param name="pIdForEach" select="$pIdForEach"/> 
     205                                                                <xsl:with-param name="pMode" select="$pMode"/> 
    203206                                                        </xsl:apply-templates> 
    204207                                                </xsl:otherwise> 
     
    209212                 
    210213                <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)}}"/> 
    212224                </xsl:template> 
    213225                 
    214226                <xsl:template match="scOd:dataBlock" mode="getBlockDef"> 
    215227                        <xsl:param name="pIdForEach"/> 
     228                        <xsl:param name="pMode"/><!-- [|ignoreAlreadyShowBlocks] --> 
    216229                        <xsl:variable name="vId" select="normalize-space(scOd:id)"/> 
    217230                        <xsl:variable name="vCategory" select="@category"/> 
     
    227240                        </xsl:variable> 
    228241                        <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))&gt;0"/> 
    229243                        <xsl:variable name="vIsContentShowInDocument"><!-- Permet de dire si la partie "contenu" de ce block a été affichée qq part dans le document --> 
    230244                                <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])&gt;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])&gt;0">true</xsl:when> 
    233247                                        <xsl:otherwise>false</xsl:otherwise> 
    234248                                </xsl:choose> 
    235249                        </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))&gt;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))&gt;0"> 
     258                                                        <definition><xsl:copy-of select="key('forEachBlock', $pIdForEach)/*"/></definition> 
     259                                                </xsl:if> 
     260                                        </block> 
     261                                </xsl:if> 
    245262                        </xsl:if> 
    246263                </xsl:template> 
     
    293310                                        <xsl:with-param name="pCateg" select="$vCateg"/> 
    294311                                        <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 --> 
    295313                                </xsl:call-template> 
    296314                        </xsl:variable> 
     
    305323                        <xsl:variable name="vCateg" select="ancestor-or-self::scOd:showDataBlocks/@category"/> 
    306324                        <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> 
    317342                 
    318343                <xsl:template match="scOd:refBlock"> 
     
    321346                        <xsl:variable name="vCategory" select="$vBlock/@category"/> 
    322347                        <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                         
    323353                        <xsl:variable name="vRefBlockId"> 
    324354                                <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> 
    326359                                </xsl:choose> 
    327360                        </xsl:variable> 
     
    330363                 
    331364                <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> 
    337392                <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> 
    338393                <xsl:template match="scOd:callBlockPages"> 
Note: See TracChangeset for help on using the changeset viewer.