Select Categories Below
Advertisement
Start Your Own Q&A Site
Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.
Status: Open Points: 125 Time: 15:22 - Jan 12, 2009
rpyerneni
I have this xml data <products> <product year="1996" state="TX" rate="9.12"/> <product year="1997" state="TX" rate="9.23"/> <product year="1998" state="TX" rate="9.31"/> <product year="1999" state="TX" rate="9.45"/> <product year="2000" state="TX" rate="9.98"/> <product year="2001" state="TX" rate="10.00"/> <product year="1996" state="NJ" rate="8.34"/> <product year="1997" state="NJ" rate="9.14"/> <product year="1998" state="NJ" rate="9.32"/> <product year="1999" state="NJ" rate="9.65"/> <product year="2000" state="NJ" rate="9.75"/> <product year="2001" state="NJ" rate="9.92"/> </products> Aftr reaching 4th year, next years should come in next row. Currently with my code the records are coming in single row per each state like this 1996 1997 1998 1999 2000 2001 TX 9.12 9.23 9.31 9.45 9.98 10.00 1996 1997 1998 1999 2000 2001 NJ 9.12 9.23 9.31 9.45 9.98 10.00 But I need the output like this... 1996 1997 1998 1999 TX 9.12 9.23 9.31 9.45 2000 2001 9.98 10.00 NJ 1996 1997 1998 1999 8.34 9.14 9.32 9.65 2000 2001 9.75 9.92 Here is my code <xsl:key name="state" match="product" use="@state"/> <xsl:key name="year" match="year" use="concat(@product, ':', @year)"/> <xsl:key name="rate" match="rate" use="concat(@product, ':', @year,':',@rate)"/> <table border="1" width="100%"> <tr> <xsl:for-each select="products/products[generate-id()=generate-id(key('state',@state)[1])]"> <xsl:variable name="statecode" select="@state"/> <td valign='bottom' width='20%' align='left'> <xsl:value-of select="@state"/> </td> <td colspan='4'> <table border='1' width='100%' cellspacing='0' cellpadding='0' > <tr> <xsl:for-each select="../product[generate-id()=generate-id(key('ltv',concat(@state, ':', @year,':',@rate))[1])]"> <td valign='bottom' align='center' width='22%'> <xsl:value-of select="@rate"/> </td> </xsl:for-each> </tr> </table> </td> </tr> </xsl:for-each> </xsl:for-each> </tr> </table>
Categories:
Add Categories
When adding more than one category, separate them with commas.
jgivoni
Date:: Jan 14, 2009
Time:: 08:20
It seems you're using a <table> to display the product data, which makes it impossible to break lines after 4 columns. Instead you can try to use <div>s, float them left and give them a width that will make the line break at the right time. Hope it works, Jakob
Date:: Mar 04, 2009
Time:: 12:03
Thank you very much. My problem was solved.
Answer this Question
New User
Email:
Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address
Registered User
Username:
Password:
Forgot Your Password?
Enter your email address below and we will resend your login information to you.
Login Information Sent
Questions
whats the best food to eat during midnight?
How to identify the tiffany jewelry? www.tffanycheapmall.com.
Send an email alert to each user of the php application based on criteria
How I Increased My AdSense Earnings?
how to choose the lady dress ?
How can I fulfill the minimum requirement to make your computer support 3D?
You have 100 characters to use
Rank
Expert
Points
1.
10354
2.
6493
3.
5596
4.
4848
5.
3487
6.
2840
7.
2770
8.
2303
9.
1820
10.
917
Register today to share your knowledge with the community and be recognized and rewarded for your contributions.
Register Here
"Psst, Quomon is a great site. Pass it on." Tell a Friend | Link To Us | Save to Delicious | Digg it
Language Options
English:
Español:
Sponsors
Questions and Answers Software