Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Re: adding column number to the entry

From: ac <ac@---------.--->
To: xsl-list@-----.------------.---
Date: 9/4/2009 2:13:00 PM
Hi Ganesh,

The template provided does exactly transform the input provided to the
sample output provided.

The fact that you are introducing new constraints only shows that your
problem is not clearly expressed.

There may be other ways to track the index from the content and the
relationship between the entries could also be different.

As everything could change, it is difficult for me to justify the time
to address all possibilities.

As Tommie pointed out,

  1. provide the smallest possible example that illustrates your
     question. (it looks to me like there is a lot of "clutter" in
     your example; for example cell names and columnspans are not
     needed to deal with the question you asked)

  2. in addition to a small example describe in words, where the
     information in the desired result would come from in the
     input. Is it the case that you want RowSpan to equal 1
     unless the value of the cell element is longer than 16
     characters? Or is there some other logic that you want
     implemented in your XSLT?

Note that expressing the problem clearly may itself provide you with a
solution path.

I'll pass to someone else for now.

Cheers,
ac


> That is only sample text (Table 1 TB...). In the real life that is not
> possible.
>
> I need to provide the sequence number of entries in that row and give
> the number in the name attribute. name=1 for the first entry and
> name=2 to the second entry etc. When morerows=1 means when rowspan is
> there the entries in the next row should get incremented from the
> entry position in the previous row.
>
>
> look at the input and generate the output given.
>
> Thanks are regards,
> Ganesh
>
>
>
>
> On Thu, Sep 3, 2009 at 5:47 PM, ac<ac@h...> wrote:
>   
>> Hi,
>>
>> I may be missing something, but how about something along the lines of:
>>
>>   <xsl:template match="entry">
>>       <cell Name="{substring(substring-after(., 'Table 1 TB C'), 1,
>> 1)}" RowSpan="{if (xs:integer(@morerows)) then @morerows + 1 else 1}"
>> ColumnSpan="1">
>>           <xsl:value-of select="."/>
>>       </cell>
>>   </xsl:template>
>>
>> Cheers,
>> ac
>>
>>
>>
>>     
>>> Please help me on this issue.
>>>
>>> Regards,
>>> Ganesh
>>>
>>>
>>> On Tue, Sep 1, 2009 at 3:09 PM, Ganesh Babu N<nbabuganesh@g...>
>>> wrote:
>>>
>>>       
>>>> Dear All,
>>>>
>>>> I am having a input like this.
>>>>
>>>> <table>
>>>>       <row>
>>>>               <entry align="left" valign="top">Table 1 TB C1 R5</entry>
>>>>               <entry align="left" valign="top" morerows="1">Table 1 TB C2
>>>> R5 and
>>>> TB C2 R6 are merged</entry>
>>>>               <entry align="left" valign="top">Table 1 TB C3 R5</entry>
>>>>               <entry align="left" valign="top">Table 1 TB C4 R5</entry>
>>>>       </row>
>>>>       <row>
>>>>               <entry align="left" valign="top">Table 1 TB C1 R6</entry>
>>>>               <entry align="left" valign="top">Table 1 TB C3 R6</entry>
>>>>               <entry align="left" valign="top">Table 1 TB C4 R6</entry>
>>>>       </row>
>>>> </table>
>>>>
>>>> My required output is as follows:
>>>>
>>>> <table>
>>>>  <cell Name="1" RowSpan="1" ColumnSpan="1">Table 1 TB C1 R5</cell>
>>>>  <cell Name="2" RowSpan="2" ColumnSpan="1">Table 1 TB C2 R5 and TB
>>>> C2 R6 are merged</cell>
>>>>  <cell Name="3" RowSpan="1" ColumnSpan="1">Table 1 TB C3 R5</cell>
>>>>  <cell Name="4" RowSpan="1" ColumnSpan="1">Table 1 TB C4 R5</cell>
>>>>  <cell Name="1" RowSpan="1" ColumnSpan="1">Table 1 TB C1 R6</cell>
>>>>  <cell Name="3" RowSpan="1" ColumnSpan="1">Table 1 TB C3 R6</cell>
>>>>  <cell Name="4" RowSpan="1" ColumnSpan="1">Table 1 TB C4 R6</cell>
>>>> </table>
>>>>
>>>> I have tried with the following code but it is changing the number in
>>>> all the 2nd row entries. It requires to be changed only in C3 of R6
>>>> and C4 of R6. Because C2 of R6 is already merged with C2 of R5.
>>>>
>>>> <xsl:template match="entry>
>>>>     <xsl:if test="parent::row/preceding-sibling::row/entry/@morerows">
>>>>          <xsl:value-of select="position() +
>>>> parent::row/preceding-sibling::row/entry[@morerows]/position()"/>
>>>>     </xsl:if>
>>>> </xsl:template>
>>>>
>>>> Please help me getting required output.
>>>>
>>>> Regards,
>>>> Ganesh
>>>>
>>>>
>>>>         
>>> --~------------------------------------------------------------------
>>> 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@l...>
>>> --~--
>>>
>>>
>>>
>>>       
>> --~------------------------------------------------------------------
>> 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@l...>
>> --~--
>>
>>
>>     
>
> --~------------------------------------------------------------------
> 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@l...>
> --~--
>
>
>   


--~------------------------------------------------------------------
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@l...>
--~--



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent