Dynamically change page header in XSLT

前端 未结 1 1992
旧巷少年郎
旧巷少年郎 2021-01-28 21:22

Dynamic change of page header in XSLT

I want same Image to be in Header however the content over image should change dynamically according to value in XML node



        
相关标签:
1条回答
  • 2021-01-28 22:25

    As @potame already mentioned in comments, <fo:marker> and <fo:retrieve-marker> are designed specially for this. Since you don't give any xml I created a simple example to show how to retrieve the marker and the logic behind it then you should be able to adapt to your code.

    <fo:flow flow_name="xsl-region-before">
        <fo:table table-layout="fixed" width="100%">
            <fo:table-body>
                <fo:table-row>
                    <fo:table-cell>
                        <fo:block>
                            <!-- Retrieve the marker value -->
                            <fo:retrieve-marker retrieve-class-name="header_value"/>
                        </fo:block>
                    </fo:table-cell>
                </fo:table-row>
            </fo:table-body>
        </fo:table>
    </fo:flow>
    

    Then somewhere in your code (probably in the region-body you will set the marker value (In your case it would be a path url if I understand your question) depending on your wanted condition. Something like :

    <xsl:when test="condition">
        <fo:marker marker-class-name="header_value"/>
            <xsl:value-of select="path_url"/>
        </fo:marker>
    </xsl:when>
    <xsl:when test="condition2">
        <fo:marker marker-class-name="header_value"/>
            <xsl:value-of select="path_url2"/>
        </fo:marker>
    </xsl:when>
    
    0 讨论(0)
提交回复
热议问题