This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
find the correct rows to apply appropriate templates
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] find the correct rows to apply appropriate templates
- From: Xiaocun Xu <xiaocunxu at yahoo dot com>
- Date: Mon, 4 Jun 2001 13:50:03 -0700 (PDT)
- Reply-To: xsl-list at lists dot mulberrytech dot com
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?
Currently, I locate and save the header rows like:
<xsl:variable name="SupplierProfileHeader"
select="book/sheet/range/row[cell[1] =
'SupplierOrganizationCode']"/>
How to locate and save the row number of this header?
The only way I can think of is to add id attribute to
<row> element so to identify row number, then I can
extract the row number with:
<xsl:variable name="SupplierProfileHeaderRow"
select="book/sheet/range/row[cell[1] =
'SupplierOrganizationCode']/@id"/>
Any better idea how this could be handled?
Much thanks,
Xiaocun
Attached Sample XML:
<row>
<cell column="1">*PerformanceFactorCode</cell>
<cell column="2">*PerformanceFactorName</cell>
<cell
column="3">*PerformanceFactorDefaultRating</cell>
<cell
column="4">PerformanceFactorDescription</cell>
</row>
<row>
<cell column="1">pf1</cell>
<cell column="2">pf1</cell>
<cell column="3">10</cell>
</row>
<row>
<cell column="1">pf2</cell>
<cell column="2">pf2</cell>
<cell column="3">20</cell>
</row>
<row>
<cell column="1">pf3</cell>
<cell column="2">pf3</cell>
<cell column="3">30</cell>
</row>
<row>
<cell column="1">*SupplierOrganizationCode</cell>
<cell column="2">SupplierName</cell>
<cell column="3">SupplierProfileCode</cell>
<cell column="4">SupplierContactName</cell>
<cell column="5">Address1</cell>
<cell column="6">Address2</cell>
<cell column="7">City</cell>
<cell column="8">State</cell>
<cell column="9">ZipCode</cell>
<cell column="10">CountryCode</cell>
</row>
<row>
<cell column="1">s1</cell>
<cell column="2">test name for s1</cell>
<cell column="3">test_s1</cell>
<cell column="4">Albert</cell>
<cell column="5">5 Brown Street</cell>
<cell column="7">Andover</cell>
<cell column="8">MA</cell>
<cell column="9">01810</cell>
<cell column="10">US</cell>
</row>
<row>
<cell column="1">EmailAddress</cell>
<cell column="2">FaxNumber</cell>
<cell column="3">WorkPhoneNumber</cell>
<cell column="4">AlternatePhoneNumber</cell>
</row>
<row>
<cell column="1">test@test.com</cell>
<cell column="2">(800) 555-1212</cell>
<cell column="3">(800) 555-1212</cell>
</row>
__________________________________________________
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