[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

Selectively transforming bits of an excel file exported to xml

Asked by irajani in Extensible Markup Language (XML), Extensible HTML (XHTML)

Tags: xsl

Hi,

I have a pricelist exported to XML which I now want to convert into a CSV file. Unfortunately, a few of my suppliers format their pricelists in a non-standard manner making a direct export to CSV non-feasible.

I am constructing an XSL file for each such supplier to pick the meaningful values I need and write to a CSV file. Here is what I have so far:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
SupplierProductId,CostPrice,Summary
  <xsl:template match="//Worksheet[normalize-space(@ss:Name)='AMD Boards']/Row">
   ****what goes here?****
  </xsl:template>
</xsl:stylesheet>

As you can see I haven't got very far. This is my first encounter with xsl and xpath and it seems pretty nifty.

Here is the logic I want to encapsulate:

- find the worksheet with name "AMD Boards" and find all rows in which cells b, c and e are not equal to null or the empty string - if this is the case i also need to get cell e of the following row

here is a snippet of the xml just to put all of this into context (no pun intended):

<Worksheet ss:Name=" AMD Boards">
  <Table ss:ExpandedColumnCount="15" ss:ExpandedRowCount="61" x:FullColumns="1"
   x:FullRows="1" ss:StyleID="s331" ss:DefaultRowHeight="11.25">
   <Column ss:StyleID="s331" ss:AutoFitWidth="0" ss:Width="21"/>
   <Column ss:StyleID="s331" ss:AutoFitWidth="0" ss:Width="68.25"/>
   <Column ss:StyleID="s607" ss:AutoFitWidth="0"/>
   <Column ss:Index="5" ss:StyleID="s331" ss:AutoFitWidth="0" ss:Width="459"/>
   <Column ss:Index="7" ss:StyleID="s331" ss:AutoFitWidth="0" ss:Width="360"/>
   <Row ss:StyleID="s302">
    <Cell ss:StyleID="s379"><Data ss:Type="String">Gigabyte-AMD Chipset</Data></Cell>
    <Cell ss:StyleID="s332"><Data ss:Type="String">GIGABYTE  MOTHERBOARDS - AMD CHIPSET - 3 YEAR FULL WARRANTY</Data></Cell>
    <Cell ss:StyleID="s593"/>
    <Cell ss:StyleID="s333"/>
    <Cell ss:StyleID="s334"/>
    <Cell ss:StyleID="s335"/>
    <Cell ss:StyleID="s335"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s309"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s301"/>
   </Row>
   <Row ss:StyleID="s302">
    <Cell ss:StyleID="s336"/>
    <Cell ss:StyleID="s337"/>
    <Cell ss:StyleID="s594"/>
    <Cell ss:StyleID="s338"/>
    <Cell ss:StyleID="s328"/>
    <Cell ss:StyleID="s328"/>
    <Cell ss:StyleID="s328"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s309"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s301"/>
   </Row>
   <Row ss:StyleID="s302">
    <Cell ss:StyleID="s336"/>
    <Cell ss:StyleID="s337"/>
    <Cell ss:StyleID="s594"/>
    <Cell ss:StyleID="s338"/>
    <Cell ss:StyleID="s328"/>
    <Cell ss:StyleID="s328"/>
    <Cell ss:StyleID="s328"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s309"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s301"/>
   </Row>
   <Row ss:AutoFitHeight="0" ss:Height="2.25" ss:StyleID="s302">
    <Cell ss:StyleID="s336"/>
    <Cell ss:StyleID="s337"/>
    <Cell ss:StyleID="s594"/>
    <Cell ss:StyleID="s338"/>
    <Cell ss:StyleID="s328"/>
    <Cell ss:StyleID="s328"/>
    <Cell ss:StyleID="s328"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s309"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s301"/>
   </Row>
   <Row ss:StyleID="s306">
    <Cell ss:StyleID="s344"><ss:Data ss:Type="String"
      xmlns="http://www.w3.org/TR/REC-html40"><B><I><U><Font html:Color="#800080">AMD </Font><Font
          html:Color="#0000FF">Socket A</Font><Font html:Color="#800080"> Platform: Integrated and Discrete</Font></U></I></B></ss:Data></Cell>
    <Cell ss:StyleID="s356"/>
    <Cell ss:StyleID="s595"/>
    <Cell ss:StyleID="s357"/>
    <Cell ss:StyleID="s358"/>
    <Cell ss:Index="7" ss:StyleID="s307"/>
    <Cell ss:StyleID="s307"/>
    <Cell ss:StyleID="s308"><Data ss:Type="String"> </Data></Cell>
   </Row>
   <Row ss:StyleID="s302"> ****This is the first row that needs to be checked for the above logic ****
    <Cell ss:Index="2" ss:StyleID="s314"><Data ss:Type="String">7VT600P-RZ</Data></Cell>
    <Cell ss:StyleID="s596"><Data ss:Type="Number">69</Data></Cell>
    <Cell ss:StyleID="s339"><Data ss:Type="String">DDR400</Data></Cell>
    <Cell ss:StyleID="s319"><ss:Data ss:Type="String"
      xmlns="http://www.w3.org/TR/REC-html40"><B><Font html:Color="#0000FF">GIGABYTE® </Font></B><Font>VIA-KT600+8237 </Font><B><U><Font
         html:Color="#FF0000">AMD K7 FSB400 integrated MB</Font></U></B><Font
       html:Color="#FF0000"> </Font><Font>-,AC97-6CH sound, VIA6103L 10/100Lan </Font></ss:Data></Cell>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s304"/>
    <Cell ss:StyleID="s304"/>
    <Cell ss:StyleID="s313"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s301"/>
    <Cell ss:StyleID="s301"/>
   </Row>
   <Row ss:Height="12" ss:StyleID="s302">
    <Cell ss:Index="2" ss:StyleID="s371"/>
    <Cell ss:StyleID="s393"/>
    <Cell ss:StyleID="s375"/>
    <Cell ss:StyleID="s359"><Data ss:Type="String">1 x AGP(8x), 3 x DDR400,2x ATA133 + 2 x PATA,5 x PCI, 6 x USB 1.1 (4 by cables), Raid, ATC Form Factor</Data></Cell>
***The value in the preceding <cell> tag should really be in the corresponding cell in the preceding row****
    <Cell ss:StyleID="s359"/>
    <Cell ss:StyleID="s362"/>
    <Cell ss:StyleID="s362"/>
    <Cell ss:StyleID="s376"/>
    <Cell ss:StyleID="s359"><Data ss:Type="String"> </Data></Cell>
    <Cell ss:StyleID="s359"/>
    <Cell ss:StyleID="s359"/>
    <Cell ss:StyleID="s359"/>
    <Cell ss:StyleID="s359"/>
    <Cell ss:StyleID="s359"/>
   </Row>

I have commented some sections so you can see what I am talking about...

In any case, if you can help with this problem I will be very grateful.
[+][-]09/12/05 02:07 AM, ID: 14862529Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Extensible Markup Language (XML), Extensible HTML (XHTML)
Tags: xsl
Sign Up Now!
Solution Provided By: Gertone
Participating Experts: 1
Solution Grade: A
 
[+][-]09/12/05 01:14 AM, ID: 14862316Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/12/05 01:23 AM, ID: 14862341Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/12/05 02:03 AM, ID: 14862506Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/12/05 02:09 AM, ID: 14862540Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/12/05 02:51 AM, ID: 14862715Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/12/05 03:00 AM, ID: 14862741Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93