[xsl] Transformation Problem (was "Help please?")

Subject: [xsl] Transformation Problem (was "Help please?")
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx (by way of B. Tommie Usdin)
Date: Wed, 7 Mar 2001 10:40:18 -0500
Date: Wed, 07 Mar 2001 09:20:06 -0600
From: "Yan Zhu" <yan.zhu@xxxxxxxxxxxxxxxxxxxxxx>
X-Mailer: Mozilla 4.76 [en] (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: help please?
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


hey all,


I been trying to figure out how to do the following:

My xml is like this:

<JavaR:JavaDocs>

        <JavaR:JDoc>
          <JavaR:Link name="Java 1.3
API">http://web02/javadocs/jdk1.3/docs/index.html</JavaR:Link>
          <JavaR:Description>contains valuable information for Java
1.3</JavaR:Description>
        </JavaR:JDoc>

        <JavaR:JDoc>
          <JavaR:Link name="Java Servlet
API">http://web02/javadocs/servlet/index.html</JavaR:Link>
          <JavaR:Description>contains valuable information for Java
Servlet API</JavaR:Description>
        </JavaR:JDoc>

        ....
</JavaR:JavaDocs>

    basically, javadocs with a bunch of JDoc nodes inside. What I want
to do, is to display this in the web page,
in a table with two columns and unlimited amount of rows based on how
many JDoc nodes I have. I want the first
JDoc node apear on the left, the seoncd apear on the right, the third
apear on the left of the next row and so on.
Something like this:

    <table>
        <tr> <td> ... </td> <td> ... </td> </tr>
        <tr> <td> ... </td> <td> ... </td> </tr>
        .... etc
    </table>

    I did figure out how to use position and mod together to sperates
the even from the odds, however, I can't figure out
where to put the <tr> and </tr> tag. and Unfortunately, they have to go
together somehow, but not in two different
conditional loops, otherwise it complains no close tag. My xsl looks
something like this:

    <xsl:template match="JavaR:JavaDocs">
    <tr VALIGN="TOP" BGCOLOR="#9999CC">
        <td COLSPAN="2"><b><font face="PrimaSans BT, Verdana,
sans-serif">
        <font color="#FFFFFF">Java Documentations
</font></font></b></td>
    </tr>
    <xsl:for-each select="JavaR:JDoc">
      <xsl:choose>
        <xsl:when test="(position() mod 2)=0">
          <xsl:call-template name="JavaDocLink" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:call-template name="JavaDocLink" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:for-each>
  </xsl:template>

this of course, doesn't do what I want it to do, but I can't find a
solution either.

any suggestions?

thanks in advance.

yan

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread