Thanks A Lot -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, April 10, 2006 5:08 PM To: fop-users@xmlgraphics.apache.org Subject: RE: RE: Guide me some extended data display
It's the same pattern. <xsl:template match="country"> <xsl:if test="position() mod 2 =1"> <fo:table-row> <fo:table-cell><fo:block><xsl:value-of select="cityInstal" /></fo:block></fo:table-cell> <fo:table-cell><fo:block><xsl:value-of select="stateInstal" /></fo:block></fo:table-cell> <fo:table-cell><fo:block><xsl:value-of select="following-sibling::country[1]/cityInstal" /></fo:block></fo:table-cell> <fo:table-cell><fo:block><xsl:value-of select="following-sibling::country[1]/stateInstal" /></fo:block></fo:table-cell> </fo:table-row> </xsl:if> </xsl:template> -- Charles Knell [EMAIL PROTECTED] - email -----Original Message----- From: Raghavendra U <[EMAIL PROTECTED]> Sent: Mon, 10 Apr 2006 12:26:10 +0530 To: undisclosed-recipients:; Subject: RE: Guide me some extended data display Hi, Thanks a Lot for your information it helped me a lot. Similar to this another problem I'm facing now. <genericSiteDoc> <country> <cityInstal>India</cityInstal> <stateInstal>state1</stateInstal> </country> <country> <cityInstal> UK </cityInstal> <stateInstal>state2</stateInstal> </country> <country> <cityInstal> USA </cityInstal> <stateInstal>state3</stateInstal> </country> <country> <cityInstal> Canada </cityInstal> <stateInstal>state4</stateInstal> </country> <country> <cityInstal> Australia </cityInstal> <stateInstal>state5</stateInstal> </country> </genericSiteDoc> And output should be Country 1 Country 2 ------------------------------------------------ India UK State1 state2 ----------------------------------------------- USA Canada State3 state4 ------------------------------------------------ Austraila State5 ----------------------------------------- Regards Raghavendra U -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Saturday, April 08, 2006 6:56 PM To: fop-users@xmlgraphics.apache.org Subject: RE: guide me This question will generally get more attention on the Mulberry-Tech XSL list, but here goes. This question reminds me of a riddle I learned in elementary school, Question: How do you get down off an elephant? Answer: You don't get down off an elephant, you get down off a duck. Humor aside, that's not what the <xsl:for-each> element is used for. Mainly, the <xsl:for-each> is used for grouping and sorting. XSLT is a declarative language, like SQL, not a procedural language, like Java. If you want to retrieve all the employees in department number 00987 from your database, you would write a query like this: "SELECT last_name, first_name from employees where department_num='00987';" You don't write some sort of loop telling the database engine when to start or stop. Similarly, with XSLT, you create a template that matches the elements you are interested in and describe the output you want. The messy looping and other stuff is handled by the XSLT transformer. You don't get involved with it. So, here's an example of two templates that, taken together, will solve your problem. <xsl:template match="genericSiteDoc"> <xsl:apply-templates /> </xsl:template> <xsl:template match="cityInstal"> <xsl:if test="position() mod 2 =1"> <fo:table-row> <fo:table-cell><fo:block><xsl:value-of select="." /></fo:block></fo:table-cell> <fo:table-cell><fo:block><xsl:value-of select="following-sibling::cityInstal[1]" /></fo:block></fo:table-cell> </fo:table-row> </xsl:if> </xsl:template> -- Charles Knell [EMAIL PROTECTED] - email -----Original Message----- From: Raghavendra U <[EMAIL PROTECTED]> Sent: Sat, 8 Apr 2006 17:28:43 +0530 To: undisclosed-recipients:; Subject: guide me ________________________________ From: Raghavendra U Sent: Saturday, April 08, 2006 5:24 PM To: fop-users@xmlgraphics.apache.org Subject: guide me Hi All, can anyone help me to solve my problem. <genericSiteDoc> <cityInstal>India</cityInstal> <cityInstal> UK </cityInstal> <cityInstal> USA </cityInstal> <cityInstal> Canada </cityInstal> <cityInstal> Australia </cityInstal> </genericSiteDoc> this is the XML data. I want to display , in a row two country names. means output should be like below Country 1 Country 2 ------------------------------------------------ India Uk ------------------------------------------------ USA Canada ------------------------------------------------ Austraila ----------------------------------------- How to control the for each loop in XSL. plz help me. Raghavendra U | Associate Software Engineer | M P H A S I S Architecting Value |139/1,Hosur Road, Koramangala, Bangalore-560 095 | Mobile: +91-9845830975| www.mphasis.com <http://www.mphasis.com/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]