Re: [xsl] InDesign IDML table conversion

Subject: Re: [xsl] InDesign IDML table conversion
From: Ganesh Babu N <nbabuganesh@xxxxxxxxx>
Date: Sat, 18 Aug 2012 23:22:21 +0530
Hi Markus,.

What about Cigarettes, It should give 0 right? but it is also giving
2. Please suggest how to over come this hurdle.

Regards,
Ganesh

On Sat, Aug 18, 2012 at 9:31 PM, Markus Abt <abt@xxxxxxxx> wrote:
> 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

Current Thread