The part that is tripping me up. I believe there is a way of programming
without a recursion template to get the results I am looking for.
The transform locates the row/entry/@morerows. The value for
@morerows[=4], add a 1 and that is the row we want to add the attribute
to. The cell"entry" where the @morerows sits is the entry in the
following row.
I need the value for @morerows 2 to be static to compare it with the
current row.
So if following::row/position() = $morerows, then create attribute. How
do I get the variable $morerows (example variable) to hold a static
number (2) so I can compare it with the position of the following row.
I do not think I need recursion for this if I can maintain the value of
the value in @morerows.
I appreciate any suggestions.
Please run my code so see what I mean.
So if there is:
<row>
<entry>
<entry @morerows="2">
<entry>
</row>
From this we should create a table with:
<row>
<cell>
<cell @start> "when row/entry/@morerows is found create the @start -
identified row, position 2 cell"
<cell>
</row>
<row>
<cell>
<cell> "first row following, position 2 cell"
<cell>
</row>
<row>
<cell>
<cell @end> "second row following, position 2 cell
<cell>
</row>
----my transform---
<xsl:template match="row">
<xsl:param name="rowPos">
<xsl:choose>
<xsl:when test=".[entry/@morerows]">
<xsl:apply-templates select="entry/@morerows"/>
</xsl:when>
</xsl:choose>
</xsl:param>
<xsl:param name="entryPos">
<xsl:for-each select="entry">
<xsl:choose>
<xsl:when test="@morerows">
<xsl:value-of select="position()"/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:param>
<xsl:param name="currentRow">
<xsl:value-of select="position()"/>
</xsl:param>
<xsl:param name="endRow">
<xsl:value-of select="number($rowPos) + 1"/>
</xsl:param>
<!--
<xsl:variable name="static">
<xsl:choose>
<xsl:when test="./entry/@morerows">
<xsl:value-of
select="ancestor::tbody/row[position()]/entry/@morerows"/></xsl:when>
</xsl:choose>
</xsl:variable>
Static: <xsl:value-of select="$static"/>-->
Current Row <xsl:value-of select="number($currentRow)"/>
Entry Position: <xsl:value-of select="number($entryPos)"/>
@Morerows Value: <xsl:value-of select="number($rowPos)"/>
Where to add attribute: Row # <xsl:value-of select="number($endRow) "/>.
(Cell) Entry Position # <xsl:value-of select="number($entryPos)"/>
------end transform-----
-----start xml------------
<table-wrapper>
<table>
<tgroup cols="5">
<!--<colspec colwidth="10"
colname="col1"/>
<colspec colwidth="11"
colname="col2"/>
<colspec colwidth="12"
colname="col3"/>
<colspec colwidth="13"
colname="col4"/>
<colspec colwidth="14"
colname="col5"/>-->
<tbody>
<row>
<entry>first</entry>
<entry>second</entry>
<entry
morerows="4">first row-third entry | </entry>
<entry>3</entry>
<entry>4</entry>
</row>
<row>
<entry>1</entry>
<entry>2</entry>
<entry>second
row-third entry | </entry>
<entry>4</entry>
</row>
<row>
<entry>1</entry>
<entry>2</entry>
<entry>third
row-third entry | </entry>
<entry>4</entry>
</row>
<row>
<entry
namest="col1" nameend="col4" morerows="2">1</entry>
<entry>2</entry>
<entry>fourth
row-third entry | </entry>
</row>
<row>
<entry>1</entry>
<entry>2</entry>
<entry>fifth
row-third entry | </entry>
<entry>4</entry>
</row>
<row>
<entry
namest="col1" nameend="col4" morerows="1">1</entry>
<entry>2</entry>
<entry>sixth
row-third entry | </entry>
</row>
<row>
<entry>1</entry>
<entry>1</entry>
<entry>seventh
row-third entry | </entry>
</row>
<row>
<entry/>
<entry/>
<entry>eighth
row-third entry |</entry>
</row>
</tbody>
</tgroup>
</table>
</table-wrapper>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--