Jump to content

Volker

Members
  • Posts

    4
  • Joined

  • Last visited

Volker's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Hi,if i use this structure of xml: ...<Word> <Chinese>你</Chinese> <PinYin>nǐ</PinYin> <PinYinNumber>ni3</PinYinNumber> </Word> <Word> <Chinese>好</Chinese> <PinYin>hǎo</PinYin> <PinYinNumber>ha3o</PinYinNumber> </Word>... with this xslt: <table border="0" cellpadding="1" rules="all" width="100%"> <xsl:for-each select="ChineseWordList"> <xsl:for-each select="Word"> <xsl:sort select="PinYinNumber"/> <td><xsl:value-of select="Chinese"/></td> <xsl:if test="position() mod 8 = 0"><tr /></xsl:if> </xsl:for-each> </xsl:for-each> </table> I get the following result(values doesn't match the contents from the XML above, but ...). <table border="0" cellpadding="1" rules="all" width="100%"><td>爱人</td><td>班</td><td>班</td><td>帮助</td><td>包</td><td>爸爸</td><td>办公室</td><tr />...</table> which is just displayed perfectly inside IE or FireFox(Using XMLSpy).Volker
  2. thx Dooberry, the knowledge about using <tr /> does it. It works.
  3. thx for the reply dooberry, the unmatched tr and /tr elements are the major point.At the moment i'm not aware of how to place them.Maybe i have to write something like:write tr, write first 20 elements and than attach the closing tr. continue this loop with the next 20 elements until all have been processed. My experience with xsl is not much , so i'm a bit lost finding a way moving thru the sorted nodetree this way.Volker
  4. Hi,i have an xml structure like this: <Word> <Chinese>...</Chinese> <PinYin>...</PinYin> </Word> <Word> <Chinese>...</Chinese> <PinYin>...</PinYin> </Word> and i want a table which is sorted by "PinYin" and contains 20 columns each row containing only the data of "Chinese":0 1 2 3 4 ... 1920 21 22 23 24 ... 29...I tried with the following xsl, which gaves me the plain text result <xsl:for-each select="ChineseWordList"> <xsl:for-each select="Word"> <xsl:sort select="PinYin"/> <xsl:value-of select="Chinese"/> <xsl:copy-of select="' '"/> <xsl:if test="position() mod 20 = 0"><br></br></xsl:if> </xsl:for-each></xsl:for-each> How could the code be changed to use a table?Replacing the br with tr doesn't work, because it must be closed and openend at the same line.
×
×
  • Create New...