W3C home > Mailing lists > Public > www-xsl-fo@w3.org > May 2008

Re: Fo-Condition check

From: Tony Graham <Tony.Graham@MenteithConsulting.com>
Date: Mon, 05 May 2008 11:42:09 +0100
To: www-xsl-fo@w3.org
Message-ID: <87y76pvxq6.fsf@zako.menteithconsulting.com>

On Mon, May 05 2008 05:05:03 +0100, saqib.javed@gmail.com wrote:
> The car related data is in element form. and my issue is resolved by just
> adding this tag
> <xsl:if text="car = ''">
> <fo:inline color="rgb(255,0,0)" font-family="Arial" font-size="16pt"
>           Test
>      </fo:inline>
>  </xsl:if>
> now if there doesn't exist the car related element in xml then this car tag is
> omited which was my requirement.

If your markup is:


then the template rule for <data> could be:

<xsl:template match="data">
 <xsl:if test="car">
 <fo:inline color="rgb(255,0,0)" font-family="Arial" font-size="16pt"

where the 'test="car"' tests for the existence of a <car> child.

Alternatively, if you process the <car> element as a consequence of an
explicit or implicit <xsl:apply-templates>, then you can just make a
template rule for <car>:

<xsl:template match="data">

<xsl:template match="car">
 <fo:inline color="rgb(255,0,0)" font-family="Arial" font-size="16pt"


Tony Graham                         Tony.Graham@MenteithConsulting.com
Director                                  W3C XSL FO SG Invited Expert
Menteith Consulting Ltd
XML, XSL and XSLT consulting, programming and training
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
Registered in Ireland - No. 428599   http://www.menteithconsulting.com
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
xmlroff XSL Formatter                               http://xmlroff.org
xslide Emacs mode                  http://www.menteith.com/wiki/xslide
Unicode: A Primer                               urn:isbn:0-7645-4625-2
Received on Monday, 5 May 2008 10:42:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 5 May 2008 10:42:38 GMT