Friday, 15 July 2011

xslt - How to generate a blank table cell? -



xslt - How to generate a blank table cell? -

why table cell disappear when there no photo existing generate? using next code not working. need alter if want generate blank table cell if there no photo existing generate?

<xsl:for-each select="..............."> <xsl:choose> <xsl:when test="*"> <xsl:if test="....."> <xsl:if test="......."> <fo:table-cell border="solid" text-align="center" font-weight="bold" number-columns-spanned="1"> <fo:block> <fo:external-graphic src="url('{concat($filepath,.....'])}')" inline-progression-dimension.maximum="4.1cm" block-progression-dimension.maximum="4cm" content-width="scale-to-fit" content-height= "scale-to-fit" scaling="uniform"/> </fo:block> </fo:table-cell> </xsl:if> </xsl:if> </xsl:when> <xsl:otherwise> <fo:table-cell border="solid" text-align="center" font-weight="bold" number-columns-spanned="1"> <fo:block> <fo:leader/> </fo:block> </fo:table-cell> </xsl:otherwise> </xsl:choose> </xsl:for-each>

your have <xsl:when test="*"> ... node empty? if outside test , passes, other ifs (you not show) not pass test, template yields nothing.

breaking downwards comments:

<xsl:when test="*"> <xsl:if test="....."> <!-- if not pass, nil --> <xsl:if test="......."> <!-- if not pass, nil --> <fo:table-cell border="solid" text-align="center" font-weight="bold" number-columns-spanned="1"> <fo:block> <fo:external-graphic src="url('{concat($filepath,.....'])}')" inline-progression-dimension.maximum="4.1cm" block-progression-dimension.maximum="4cm" content-width="scale-to-fit" content-height= "scale-to-fit" scaling="uniform"/> </fo:block> </fo:table-cell> </xsl:if> </xsl:if> </xsl:when> <xsl:otherwise> <fo:table-cell border="solid" text-align="center" font-weight="bold" number-columns-spanned="1"> <fo:block> <fo:leader/> </fo:block> </fo:table-cell> </xsl:otherwise>

xslt xsl-fo

No comments:

Post a Comment