Greetings, I've been scratching my head on this one for a while and after searching through JIRA, found a couple bugs related to this but it appears they should have been fixed in version 2.6.0. but I'm still seeing some strange behavior.
What I want is to render 2 columns of data where each column contains rows with x number of values. For this example 4 values. If the row contains less than 4 values, then render an empty place holder cell. Here is what I get when I view the xml file transformed using a web browser: AAA BBB CCC DDD AAA BBB CCC DDD AAA BBB CCC DDD AAA BBB CCC DDD AAA BBB CCC DDD AAA BBB CCC DDD AAA BBB CCC AAA BBB CCC This is the expected behavior. Here is what I get when I view the xml file transformed with Xalan 2.6.0: AAA AAA BBB CCC DDD AAA AAA BBB CCC DDD AAA AAA BBB CCC AAA AAA BBB CCC Only the first value in each row of the first column is rendered. The second column row values have "shifted" to the left. Here is what I get when I view the xml file transformed with Xalan 2.6.0 without the offending XSL last(). AAA BBB CCC DDD AAA BBB CCC DDD AAA BBB CCC DDD AAA BBB CCC DDD AAA BBB CCC DDD AAA BBB CCC DDD AAA BBB CCC AAA BBB CCC This is expected behavior because the code which renders the place holder cells (which uses the last())is commented out. Here is the xml: <?xml version="1.0"?> <data> <item>AAA</item> <item>BBB</item> <item>CCC</item> <item>DDD</item> <item>AAA</item> <item>BBB</item> <item>CCC</item> <item>DDD</item> <item>AAA</item> <item>BBB</item> <item>CCC</item> </data> Here is the xsl: <?xml version="1.0" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <title>Output</title> </head> <body> <table border="1"> <tr> <td>  </td> <td>  </td> <td>  </td> <td>  </td> <td rowspan="10">  </td> <td>  </td> <td>  </td> <td>  </td> <td>  </td> </tr> <xsl:apply-templates/> </table> </body> </html> </xsl:template> <xsl:template match="data"> <xsl:for-each select="item[position() mod 4 = 1]"> <tr> <!-- Render values --> <xsl:for-each select=".|following-sibling::item[position() < 4]"> <td> <xsl:value-of select="."/> </td> <!-- render any buffer cells --> <!-- This is the problem code --> <xsl:if test="(last() < 4) and (last() = position())"> <xsl:call-template name="loop"> <xsl:with-param name="repeat" select="number(4-last())"/> </xsl:call-template> </xsl:if> </xsl:for-each> <!-- Render values --> <xsl:for-each select=".|following-sibling::item[position() < 4]"> <td><xsl:value-of select="."/></td> </xsl:for-each> </tr> </xsl:for-each> </xsl:template> <!-- Recursive for-loop --> <xsl:template name="loop"> <xsl:param name="repeat">0</xsl:param> <xsl:if test="number($repeat) >= 1"> <td>  </td> <xsl:call-template name="loop"> <xsl:with-param name="repeat" select="$repeat - 1"/> </xsl:call-template> </xsl:if> </xsl:template> </xsl:stylesheet> I have made sure that the program is using the correct Xalan version by placing the xalan.jar, xercesImpl.jar, and xml-apis.jar in the JAVA_HOME/lib/endorsed. I have also included calls to EnvironmentCheck which displays the version of Xalan which is 2.6.0. It would be interesting if others who run this code get the same behavior. I'm assuming this is not the expected behavior as my browser renders the data as expected and Xalan does not. Any help would be appreciated. robert
