- From: Tony Graham <Tony.Graham@MenteithConsulting.com>
- Date: Fri, 24 Oct 2008 10:42:15 +0100
- To: www-xsl-fo@w3.org
On Thu, Oct 16 2008 13:31:48 +0100, j.delaguila@dysmatica.es wrote: > Hi all, > I have a XML document like this: > > .... > <documents> > <document> > ... > </document> > <document> > ... > </document> > </documents> > > and a xsl like this: > > <fo:block space-after="12"> > <fo:table table-layout="fixed" width="100%" border="1" > border-style="solid" border-color="#55A0dd"> > <fo:table-column /> > <fo:table-body> > <xsl:apply-templates select="documents/document" /> > </fo:table-body> > </fo:table> > > </fo:block> > ..... ... > the problem is when the tag <documents> doesn't contain any <document> tag, > so the table header is created but no row added. error: > fo:table-body is missing child elements. > > How could I manage this so when no document tag exists inside documents tag > nothing would be displayed? Put the fo:block inside an xsl:if; i.e., put <xsl:if test="documents/document"> before the <fo:block> and put </xsl:if> after the </fo:block>. Also, you can use "space-after" with fo:table, so the fo:block isn't strictly necessary. Regards, 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 Friday, 24 October 2008 09:45:39 UTC