Everybody,please forgive me for this double post,the fact is that i
replied correctly but to wrong question previously :(
Aron,
the reason why this code you suggest doesn't work is that my inputs
are declared as
<input type="radio" id="{generate-id()}" name="{$id}" value="{(_at_)value}">
and the generate-id() functions probably loses reference to the context
node when used inside the <xsl:template
match="opt">(now fi:item) as you suggested.
I adapted your snippets to produce this:
<xsl:for-each select="fi:selection-list/fi:item[position() <=
current()/$line]">
<xsl:variable name="r" select="position() - 1"/>
<tr>
<xsl:apply-templates select="fi:item[position() >= $r * $column + 1
and position() <= $r * $column + $column ]"/>
</tr>
</xsl:for-each>
(...)
<xsl:template match="fi:item">
<td>
<input type="radio" id="{generate-id()}" name="{$id}"
value="{(_at_)value}">
(...)
</xsl:template>
Also the output i'm trying to achieve is e.g. for a table with 2 lines and
2 columns is
<td>
<input>
</td>
<td>
<input>
</td>
<tr> <!--I can only have (($number_of_lines) - 1) tr tags -->
<td>
<input>
</td>
<td>
<input>
</td>
</tr>
TIA, TG(thanks again),
CarlosN.
On Sat, 18 Jun 2005, Aron Bock wrote:
Carlos, I somewhat lost track of what you're trying to do, in the long-winded
explanation -- what works for me is seeing input, required output, then any
explanation of what changes may/not be made. Anyway, see this thread:
http://www.biglist.com/lists/xsl-list/archives/200506/msg00517.html
Regards,
--A
From: "Carlos M. S. Bento Nogueira"
<cmsbn(_at_)student(_dot_)dei(_dot_)uc(_dot_)pt>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] A tricky problem
Date: Sat, 18 Jun 2005 17:32:12 +0100 (WEST)
Hello!
I'm trying to create a piece of xsl code that dinamicaly displays items on
a table.This seems a basic problem at first glance, but if you're
curious(and a bit pacient) please continue reading :)
This is my item list:(temp.xml)
<fd:selection-list>
<fd:item value="Dcor"/>
<fd:item value="DAo"/>
<fd:item value="InsAo"/>
<fd:item value="EstAo"/>
</fd:selection-list>
Note that i cannot change the item properties, e.g. , to add another
attribute like position="row" to fd:item nor
can i add description tags between item lists e.g. :
<fd:item value="Dcor"/>
<row></row>
<fd:item value="DAo"/>
The description of this item lists is passed to the xsl by
snippet:(temp_action.xml)
<table border="0">
<tr>
(...)
<td>
<ft:widget id="diagnostico_opcoes">
<fi:styling list-type="radio" list-orientation="horizontal"
line="2" column="2"/>
</ft:widget>
</td>
(...)
</tr>
where we describe the list orientation layout and number of columns and
rows we want on a table.
The piece of xsl code which iterates through the items on this list is
given by this snippet:
<xsl:for-each select="descendant-or-self::fi:item">
(..)
</xsl:for-each>
although the following piece of code also produces the same results:
<xsl:for-each select="fi:selection-list/fi:item">
(...)
</xsl:for-each>
Inside the iteration code snippet, i should build a set of instructions
that could produce an HTML output like
<td>
<input name="Dcor" .../>
<td/>
<td>
<input name="Dao" .../>
<td/>
<tr>
<td>
<input name="InsAo" .../>
<td/>
<td>
<input name="EstAo" .../>
<td/>
<tr/>
My last attemp to produce this, was the following piece of code:
<xsl:variable name="elements" select="count(descendant-or-self::fi:item)"/>
<xsl:for-each select="descendant-or-self::fi:item">
<!-- Counts the iteration number temp= 1,2,3,4 ... -->
<xsl:variable name="temp"
select="($elements)-(count(following-sibling::*))"/>
<xsl:if test="$temp<$line">
<tr>
<xsl:if test="temp<$column">
<td>
<input type="radio" ..../>
</td>
</xsl:if>
</tr>
</xsl:if>
(...)
This would work great if instead of if test="..." i had a
for-each select="(1 to $line)"
for-each select="(1 to $column)"
and although this is possible since i'm using Saxon8 it doesn't do the
trick for
the following reasons:
- i should only change lines if i have $line>=2
- the following snippet is invalid as a mean to insert lines between
columns:
<xsl:if test="$line>=2">
<tr>
</xsl:if>
(code to show inputs here)
<xsl:if test="$line>=2">
</tr>
</xsl:if>
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
--~------------------------------------------------------------------
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>
--~--
--
--~------------------------------------------------------------------
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>
--~--