XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Jerry JanofskySubject: Need help with FO:Table-row
Author: Jerry Janofsky
Date: 12 Oct 2007 06:17 PM
I am trying to do something with a fo:table that I think should be straight forward, but I am having difficulty. Below I will give a simplified example of what I am trying to do.

I have my XML data in the following format:

<Persons>
<Person>
<Name>Joe</Name>
</Person>
<Person>
<Name>Joe</Name>
</Person>
.

</Persons>

Postnext
Jerry JanofskySubject: Need help with FO:Table-row
Author: Jerry Janofsky
Date: 12 Oct 2007 06:40 PM
Please excuse the previous two postings, they posted accidently.

I am trying to do something with a fo:table that I think should be straight forward, but I am having difficulty. Below I will give a simplified example of what I am trying to do.

I have my XML data in the following format:

<Persons>
<Person>
<Name>Joe</Name>
</Person>
<Person>
<Name>Jason</Name>
</Person>
<Person>
<Name>Jimmy</Name>
</Person>
<Person>
<Name>Julie</Name>
</Person>
<Person>
<Name>Jane</Name>
</Person>
</Persons>


I want to make a table that has 3 columns of names. The first column has the first person's name, the second column has the second person's name, the third the third person's name. The fourth person would start a new row. The above XML example should have generate a two table row like this

Joe Jason Jimmy
Julie Jane


I am having trouble with this. I tried doing something with a for-each as shown below. My syntax here might be a little off, but I think you can get the picture. I didn't include fo:table but assume the parent table elements are present. My attempt below doesn't work at all because I get "unexpected characters in element end tag (expected "fo:table-row"). I don't really understand why? There is probably a much simpler way to do this. Your help will be appreciated.


<xsl:for-each select="$PersonsGroup">
<xsl:if test="(position() mod 3) = 0">
<fo:table-row>
</xsl:if>

<fo:table-cell>
<fo:block><xsl:value-of select="person/name"/></fo:block>
</fo:table-cell>

<xsl:if test="((position() mod 3) = 2) or (position()=last()">
</fo:table-row>
</xsl:if>

</xsl:for-each>


Posttop
Jerry JanofskySubject: Need help with FO:Table-row
Author: Jerry Janofsky
Date: 13 Oct 2007 11:54 AM
I figured out my problem. What I have below works. I was getting invalid XML from the XML parser. I had to CDATA the fo:table-row elements. Thanks all who attempted to help.



<xsl:for-each select="$PersonsGroup">
<xsl:if test="(position() mod 1) = 0">
<![CDATA[<fo:table-row>]></xsl:if>

<fo:table-cell>
<fo:block><xsl:value-of select="person/name"/></fo:block>
</fo:table-cell>

<xsl:if test="((position() mod 3) = 2) or (position()=last()">
<![CDATA[</fo:table-row>]]></xsl:if>
</xsl:for-each>

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.