This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Re: find the correct rows to apply appropriate templates


Thanks Dimitre, this gets exactly what I needed.

Xiaocun

--- Dimitre Novatchev <dnovatchev@yahoo.com> wrote:
> Hi Xiaocun,
> 
> The following stylesheet demonstrates how to find
> what you call the row number of
> the header rows:
> 
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>  <xsl:output method="text"/>
> 
>   <xsl:variable name="firstRowPos" select="1" />
> 
>   <xsl:variable name="secndRowPos"
>   select="count(book/sheet/range/row
>                    [cell[1] =
> '*SupplierOrganizationCode']
>                    /preceding-sibling::row)
>            + 1" />
> 
>   <xsl:variable name="thirdRowPos"
>   select="count(book/sheet/range/row
>                    [cell[1] = 'EmailAddress']
>                    /preceding-sibling::row)
>            + 1" />
> 
>   <xsl:template match="/">
>      <xsl:value-of select="concat('secndRowPos: ',
> $secndRowPos, '
',
>                                   'thirdRowPos: ',
> $thirdRowPos)"/>
>   </xsl:template>
> </xsl:stylesheet>
> 
> 
> The result is:
> 
> secndRowPos: 5
> thirdRowPos: 7
> 
> Hope this helped.
> 
> Cheers,
> Dimitre Novatchev.
> P.S. I had to guees and add a book, sheet, and range
> node containing your sample xml
> data.
> Xiaocun Xu wrote:
> 
> Hi,
> 
>   I still have a problem trying to convert the
> generic
> XML (generated from spreadsheet, attached at the end
> of this message) to the specific XML I needed.
>   The structure of the generic XML has 4 sections,
> each section is consisted of a header row and (1 or
> more) detail rows.  For each of those sections, I
> need
> to apply a different template.
>   The problem, how to find the starting and ending
> row
> of each of the sections, and therefore apply the
> appropriate templates to those rows?
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail -
> only $35 
> a year!  http://personal.mail.yahoo.com/
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]