- From: hisameer <cool_sameer_for_u@yahoo.com>
- Date: Wed, 13 Aug 2008 13:00:09 -0700 (PDT)
- To: www-xsl-fo@w3.org
I have a piece of code defined in my xslt file in order to format some info for the printing purposes. But sometimes, the object which I am transforming against this xslt, doesn't have the myAccountInfo tag's child elements and I get the exception . But I want something like this : if the elements exists then print the info otherwise just print "not available" or "Unknown" So if firstName element is not available then put "unknown" in place. Can some body please help me about it and tell me how I can deal with it. Please put a little example code if possible. Here is a piece of code I am using: <xsl:template match="myAccountInfo"> <fo:table xmlns:fo="http://www.w3.org/1999/XSL/Format" table-layout="fixed" font-size="10pt" font-family="Arial, Helvetica, sans-serif"> <fo:table-column column-number="1" column-width="1.75in"/> <fo:table-column column-number="2" column-width="1.75in"/> <fo:table-column column-number="3" column-width="1.75in"/> <fo:table-column column-number="4" column-width="1.75in"/> <fo:table-body> <fo:table-row> <fo:table-cell xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" text-align="center" color="#0000FF" padding-before="2pt" padding-bottom="3pt"> <xsl:value-of select="firstName"/> </fo:block> </fo:table-cell> <fo:table-cell xmlns:fo="http://www.w3.org/1999/XSL/Format"> > <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" text-align="center" color="#0000FF" padding-before="2pt" padding-bottom="3pt"> <xsl:value-of select="lastName"/> </fo:block> </fo:table-cell> <fo:table-cell xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" text-align="center" color="#FF0000" padding-before="2pt" padding-bottom="3pt"> <xsl:value-of select="emailAddress"/> </fo:block> </fo:table-cell> <fo:table-cell xmlns:fo="http://www.w3.org/1999/XSL/Format"> > <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" text-align="center" color="#FF0000" padding-before="2pt" padding-bottom="3pt"> <xsl:value-of select="zipCode"/> </fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> </xsl:template> and the error I am getting is : com.user.infra.CustomeException: xml transform error -- org.apache.fop.fo.ValidationException: :823:-1: Error(823/-1): fo:table-row is missing child elements. Required Content Model: (table-cell+) at com.user.infra.prt.printInit(PrtUtil.java:271) I will really appreciate for the help! -- View this message in context: http://www.nabble.com/fo%3Atable-row-is-missing-child-elements-Exception-tp18969406p18969406.html Sent from the w3.org - www-xsl-fo mailing list archive at Nabble.com.
Received on Thursday, 14 August 2008 04:37:48 UTC