You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Bojan Čekrlić <ce...@parsek.net> on 2001/03/06 19:33:03 UTC

[Xalan-J bug] XPath bug?

Hi.
 
I have a quite specific stylesheet - I'm outputing a row of tags into
table, i.e.
 
<rowset>
  <row>..</row>
  <row>..</row>
  <row>..</row>
   ...
</rowset>
 
The catch is, that it two rows are to be in the same table row,
something like:
...
<tr>
  <td>row1</td><td>row2</td>
</tr>
<tr>
  <td>row3</td><td>row4</td>
</tr>
...
 
 
So I figured I'll use a for-each which will count up to a half of rows.
This is a scaled down example:
<xsl:template ...>
  <xsl:variable name="cnt" select="count(rowset/rows)" />
  <xsl:variable name="half" select="ceiling($cnt div 2)" />
  <xsl:for-each select="rowset/rows[position() &lt; $half]">
    <xsl:variable name="pos" select="position()" />
    <tr>
      <td><xsl:value-of select="//rowset/rows[position()=$pos]/text()"
/></td>
      <td><xsl:value-of
select="//rowset/rows[position()=($pos+$half)]/text()" /></td>
    </tr>
  </xsl:for-each>
 
 
I don't know why, but similar example (I guess this one will also, but
haven't tried it, it's written from the top of my head) will output only
the first eight (8) rows, all the others will not be found (nothing is
returned).
 
Am I missing something or have I stumbled across a bug?
 
 
 
Bojan

Re: [Xalan-J bug] XPath bug?

Posted by Gary L Peskin <ga...@firstech.com>.
> Bojan Èekrliæ wrote:
> 
> Hi.
> 
> I have a quite specific stylesheet - I'm outputing a row of tags into
> table, i.e.
> ...

I think we'd need to see a minimal, but complete, input XML and XSLT
that recreates the problem.

Gary