|
[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
RE: A tricky problem
Subject: RE: A tricky problem
From: "Aron Bock" <aronbock@xxxxxxxxxxx>
Date: Sat, 18 Jun 2005 22:07:18 +0000
|
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@xxxxxxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: 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/

|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
| RSS 2.0 |
|
| Atom 0.3 |
|
|