![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: How to control loop to display in special style? [Thread Next] Re: How to control loop to display in special style?To: NULL Date: 7/2/2004 11:37:00 AM It's so nice of you offering me such a detailed and appropriate answer. Thanks a lot. Pei ==================== "Kelly White" <kellywhite@g...> дÈëÓʼþ news:40e44e8f$1_4@n...... > > "Erming Pei" <erming.pei@c...> wrote in message > news:ucjJW04XEHA.3512@T...... > > Since the variables in XSLT could not change it's value, then how to creat > a > > table like the following: > > > > ===================================================== > > |Name |Sex |Age ||Name |Sex |Age ||Name |Sex | Age|| > > ----------------------------------------------------- > > | | | || | | || | | || > > ----------------------------------------------------- > > | | | || | | || | | || > > ----------------------------------------------------- > > | | | || | | || | | || > > ----------------------------------------------------- > > | | | || | | || | | || > > ....... > > > > ? > > > > I mean ,without an valid variable like in c/c++/java, how to control the > > loop to display message conforming to the style above? > > I can only display one of the group, like this: > > > > =================== > > |Name |Sex |Age || > > ------------------- > > | | | || > > ------------------- > > | | | || > > ------------------- > > | | | || > > > > Anyone could lend me a hand? > > > > Thanks in advance.. > > > > > > Pei > > > > > > > > The following should do what you want. > > > xml > > <?xml version="1.0" encoding="UTF-8"?> > > <list> > > <person> > > <name>john</name> > > <sex>male</sex> > > <age>33</age> > > </person> > > <person> > > <name>mary</name> > > <sex>female</sex> > > <age>35</age> > > </person> > > <person> > > <name>paul</name> > > <sex>male</sex> > > <age>23</age> > > </person> > > <person> > > <name>jerry</name> > > <sex>male</sex> > > <age>57</age> > > </person> > > <person> > > <name>pam</name> > > <sex>female</sex> > > <age>32</age> > > </person> > > </list> > > > > xsl > > > > <?xml version="1.0" encoding="UTF-8"?> > > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> > > <xsl:template match="/"> > > <html> > > <head> > > <title>table</title> > > </head> > > <body> > > <xsl:apply-templates/> > > </body> > > </html> > > </xsl:template> > > <xsl:template match="list"> > > <table border="1"> > > <tr> > > <td>name</td> > > <td>sex</td> > > <td>age</td> > > <td>name</td> > > <td>sex</td> > > <td>age</td> > > <td>name</td> > > <td>sex</td> > > <td>age</td> > > </tr> > > <tr> > > <xsl:for-each select="person"> > > <td> > > <xsl:value-of select="name"/> > > </td> > > <td> > > <xsl:value-of select="sex"/> > > </td> > > <td> > > <xsl:value-of select="age"/> > > </td> > > <xsl:if test="position() mod 3 = 0"> > > <xsl:text disable-output-escaping="yes"><![CDATA[</tr><tr>]]></xsl:text> > > </xsl:if> > > </xsl:for-each> > > </tr> > > </table> > > </xsl:template> > > </xsl:stylesheet> > > | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
