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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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>

   
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.