xsl-list
[Top] [All Lists]

Re: [xsl] InDesign IDML table conversion

2012-08-18 11:01:21
Hi,

Ganesh Babu N wrote:
[...]
                                      <tr>
                                              <td morerows="1" 
rowspan="2">Cigarettes</td>
                                              <td>NA</td>
                                              <td morerows="1" 
rowspan="2">test</td>
                                              <td>7.6</td>
                                      </tr>
[...]
                                      <tr>
                                              <td morerows="1" 
rowspan="2">Inhalants</td>
                                              <td morerows="1" 
rowspan="2">6</td>
                                              <td morerows="1" 
rowspan="2">0.5</td>
                                              <td>0.0</td>
                                      </tr>
[...]
I am trying to find out the number tds before the td[@morerows], so
that i can increase the cell count accordingly. But it is not giving
the exact number of tds. For the first set it should give 0 and 2 and
for the 2nd set it should give 3 . But it is giving 2 everywhere.
Please suggest me where I am going wrong.

Here is my style sheet
[...]
                                      <xsl:when 
test="parent::tr/preceding-sibling::tr[1]/td[@morerows]">
                                              <xsl:value-of
select="concat($trpos,':',count(parent::tr/preceding-sibling::tr[1]/td[@morerows]/preceding-sibling::td))"/>
                                      </xsl:when>
[...]

In the above code, "parent::tr/preceding-sibling::tr[1]/td[@morerows]" 
selects _all_ <td>s with a @morerows attribute in the preceding row. 
Then, "preceding-sibling::td" selects all preceding <td>s, i.e. in your 
input, the two <td>s preceding "test" and "0.5", respectively. In other 
words, you are counting the maximum number of preceding <td>s, 
which happens to be 2 in both cases.

Markus


--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>