473,721 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question about create pivot table in xslt

Lee
I have a xml file, here is sample part:
<?xml version="1.0" encoding="UTF-8"?>
<ProducsList>
<Product id="1">
<SpecList>
<Spec>
<SpecLabel>Heig ht</SpecLabel>
<SpecValue>10 </SpecValue>
<SpecCat>Dimens ion</SpecCat>
</Spec>
<Spec>
<SpecLabel>Widt h</SpecLabel>
<SpecValue>6</SpecValue>
<SpecCat>Dimens ion</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weig ht</SpecLabel>
<SpecValue>20.5 </SpecValue>
<SpecCat>Weigth </SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="2">
<SpecList>
<Spec>
<SpecLabel>Heig ht</SpecLabel>
<SpecValue>8</SpecValue>
<SpecCat>Dimens ion</SpecCat>
</Spec>
<Spec>
<SpecLabel>Widt h</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimens ion</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weig ht</SpecLabel>
<SpecValue>18 </SpecValue>
<SpecCat>Weigth </SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="3">
<SpecList>
<Spec>
<SpecLabel>Heig ht</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimens ion</SpecCat>
</Spec>
<Spec>
<SpecLabel>Widt h</SpecLabel>
<SpecValue>2</SpecValue>
<SpecCat>Dimens ion</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weig ht</SpecLabel>
<SpecValue>10 </SpecValue>
<SpecCat>Weigth </SpecCat>
</Spec>
</SpecList>
</Prodcut>
</ProductsList>

I need to create a table look like that based on that xml file:

----------------------------------------------------
Label Product 1 product 2 product 3
----------------------------------------------------
Height 10 8 5
Width 6 5 2
Weight 20.5 18 10

I am totally losed, I don't know how to create that table. any one has
any idea about that? thank you very much.

Also how many Spec in SpecList is unkown.

Thanks for the help.

May 31 '07 #1
14 5152
Lee wrote:
I am totally losed, I don't know how to create that table. any one has
any idea about that? thank you very much.
Break it down into parts. Express it in English -- or whatever language
you're most comfortable in -- and then use that as a guide to writing
the XSLT.

1) Pick one line of the table. How do you retrieve all the values needed
for that line? (Hint: You'll need to use a predicate.) What do you want
to surround those values with in order to display them in that line? (If
you're producing an HTML table, that would be <tdelements.) What does
the line have to be surrounded with to make it display as a line? (If
you're producing HTML, that would be a <trelement.)

2) Repeat for the other lines of the table.

3) What do you need to surround the lines with in order to display the
table? (If you're producing HTML, that would be a <tableelement .)

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
May 31 '07 #2
Lee
Joe,

Thanks a lot for your reply. I am pretty new to xslt, so I don't quite
understand what you mean. do you have any sample codes for that?
Thanks again.

On May 31, 4:44 pm, Joe Kesselman <keshlam-nos...@comcast. netwrote:
Lee wrote:
I am totally losed, I don't know how to create that table. any one has
any idea about that? thank you very much.

Break it down into parts. Express it in English -- or whatever language
you're most comfortable in -- and then use that as a guide to writing
the XSLT.

1) Pick one line of the table. How do you retrieve all the values needed
for that line? (Hint: You'll need to use a predicate.) What do you want
to surround those values with in order to display them in that line? (If
you're producing an HTML table, that would be <tdelements.) What does
the line have to be surrounded with to make it display as a line? (If
you're producing HTML, that would be a <trelement.)

2) Repeat for the other lines of the table.

3) What do you need to surround the lines with in order to display the
table? (If you're producing HTML, that would be a <tableelement .)

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry

Jun 1 '07 #3
Lee wrote:
Thanks a lot for your reply. I am pretty new to xslt, so I don't quite
understand what you mean. do you have any sample codes for that?
If you're asking that general a question, it sounds like you really need
to start by reading some XSLT tutorials. See my 5/29 post to the
"Transformi ng xhtml with xslt" thread for a list of good places to look
for information. In particular, IBM's site has many good tutorials and
articles, and the XSLT FAQ website has many examples worth studying.

See also http://www.catb.org/~esr/faqs/smart-questions.html -- I'm sure
you didn't intend it, but your question reads entirely too much like
"please do my homework assignment for me."

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jun 1 '07 #4
Lee
On May 31, 5:33 pm, Joe Kesselman <keshlam-nos...@comcast. netwrote:
Lee wrote:
Thanks a lot for your reply. I am pretty new to xslt, so I don't quite
understand what you mean. do you have any sample codes for that?

If you're asking that general a question, it sounds like you really need
to start by reading some XSLT tutorials. See my 5/29 post to the
"Transformi ng xhtml with xslt" thread for a list of good places to look
for information. In particular, IBM's site has many good tutorials and
articles, and the XSLT FAQ website has many examples worth studying.

See alsohttp://www.catb.org/~esr/faqs/smart-questions.html-- I'm sure
you didn't intend it, but your question reads entirely too much like
"please do my homework assignment for me."

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Joe,

Thanks for the reply.

Jun 1 '07 #5
Lee
On May 31, 5:33 pm, Joe Kesselman <keshlam-nos...@comcast. netwrote:
Lee wrote:
Thanks a lot for your reply. I am pretty new to xslt, so I don't quite
understand what you mean. do you have any sample codes for that?

If you're asking that general a question, it sounds like you really need
to start by reading some XSLT tutorials. See my 5/29 post to the
"Transformi ng xhtml with xslt" thread for a list of good places to look
for information. In particular, IBM's site has many good tutorials and
articles, and the XSLT FAQ website has many examples worth studying.

See alsohttp://www.catb.org/~esr/faqs/smart-questions.html-- I'm sure
you didn't intend it, but your question reads entirely too much like
"please do my homework assignment for me."

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Anybody else can help me out with this question? I know my knowledge
about xsl are really poor, but it is imposible for me to learn all
those stuff in one day. I will take some time to learn it step by
step. but for this particular question, I really need people with
experience give me some clue on how to deal with it. Thanks a lot!

Jun 1 '07 #6
Lee
On May 31, 6:55 pm, Lee <lee.jenkins... @gmail.comwrote :
On May 31, 5:33 pm, Joe Kesselman <keshlam-nos...@comcast. netwrote:


Lee wrote:
Thanks a lot for your reply. I am pretty new to xslt, so I don't quite
understand what you mean. do you have any sample codes for that?
If you're asking that general a question, it sounds like you really need
to start by reading some XSLT tutorials. See my 5/29 post to the
"Transformi ng xhtml with xslt" thread for a list of good places to look
for information. In particular, IBM's site has many good tutorials and
articles, and the XSLT FAQ website has many examples worth studying.
See alsohttp://www.catb.org/~esr/faqs/smart-questions.html--I'm sure
you didn't intend it, but your question reads entirely too much like
"please do my homework assignment for me."
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry

Anybody else can help me out with this question? I know my knowledge
about xsl are really poor, but it is imposible for me to learn all
those stuff in one day. I will take some time to learn it step by
step. but for this particular question, I really need people with
experience give me some clue on how to deal with it. Thanks a lot!- Hide quoted text -

- Show quoted text -
or anybody knows there are already some discussion on the similar
question? Please let me know what keywords I should use to search this
question. Thanks a lot.

Jun 1 '07 #7
or anybody knows there are already some discussion on the similar
question?
I already mentioned the Filk FAQ website, among other resources. Google
Is Your Friend. Your homework is YOUR homework.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jun 1 '07 #8
Sorry, crossed threads; let me corrct that...
or anybody knows there are already some discussion on the similar
question?
I already mentioned the XSLT FAQ website, among other resources. Google
Is Your Friend. You have a homework assignment.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jun 1 '07 #9
See:

http://www.topxml.com/code/default.a...20010226151246
Cheers,
Dimitre Novatchev
"Lee" <le************ @gmail.comwrote in message
news:11******** **************@ p77g2000hsh.goo glegroups.com.. .
>I have a xml file, here is sample part:
<?xml version="1.0" encoding="UTF-8"?>
<ProducsList>
<Product id="1">
<SpecList>
<Spec>
<SpecLabel>Heig ht</SpecLabel>
<SpecValue>10 </SpecValue>
<SpecCat>Dimens ion</SpecCat>
</Spec>
<Spec>
<SpecLabel>Widt h</SpecLabel>
<SpecValue>6</SpecValue>
<SpecCat>Dimens ion</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weig ht</SpecLabel>
<SpecValue>20.5 </SpecValue>
<SpecCat>Weigth </SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="2">
<SpecList>
<Spec>
<SpecLabel>Heig ht</SpecLabel>
<SpecValue>8</SpecValue>
<SpecCat>Dimens ion</SpecCat>
</Spec>
<Spec>
<SpecLabel>Widt h</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimens ion</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weig ht</SpecLabel>
<SpecValue>18 </SpecValue>
<SpecCat>Weigth </SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="3">
<SpecList>
<Spec>
<SpecLabel>Heig ht</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimens ion</SpecCat>
</Spec>
<Spec>
<SpecLabel>Widt h</SpecLabel>
<SpecValue>2</SpecValue>
<SpecCat>Dimens ion</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weig ht</SpecLabel>
<SpecValue>10 </SpecValue>
<SpecCat>Weigth </SpecCat>
</Spec>
</SpecList>
</Prodcut>
</ProductsList>

I need to create a table look like that based on that xml file:

----------------------------------------------------
Label Product 1 product 2 product 3
----------------------------------------------------
Height 10 8 5
Width 6 5 2
Weight 20.5 18 10

I am totally losed, I don't know how to create that table. any one has
any idea about that? thank you very much.

Also how many Spec in SpecList is unkown.

Thanks for the help.

Jun 1 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5843
by: Rob | last post by:
I'm just getting around to using pivot tables and charts. I find the Pivot table interface to be INCREDIBLY frustrating. When I view a table in Design view, then choose Pivot table view, I get the PivotTable Field list, from which I can choose to add fields to the view. 1. How do you get RID of a field once you put it in? I can not right click on anywhere in the view and have ANY of the submenu options be availble. From the PivotTable...
4
11692
by: Ajay | last post by:
Hello all, I used to display reports in Excel earlier on my website. Now the client has requested that he would like see reports in Pivot table on the web . The backend is Sql2000. Can you please help in determining hoe we can create a pivot table and display records in it using C#? Thanks Ajay
9
6794
by: PeteCresswell | last post by:
I've got something called "Reference Rates". The idea is that on a given day, we have various rates of return for various entities. e.g. Libor 3-month return, Libor 6-month return, US Treasury Bonds, the Prime rate, and so-forth. We associate a security with one of those rates. There are a set of rates for each calendar day, and the rates for that
0
1941
by: salad | last post by:
I have A97 and A2003. I created a form using the Pivot Table wizard. This creates an unbound form with an embedded OLE object containing a Pivot table in Excel. There are 2 controls when the form is created; the Excel spreadsheet object and a button to "Edit Pivot Table" The code for the button executes Me!PivotTable.Verb = acOLEVerbOpen Me!PivotTable.Action = acOLEActivate Is there a way to refresh the pivot table? Each time I...
2
13521
by: LittlePhil via AccessMonster.com | last post by:
Someone please help before i start to cry. I'm trying to export from Access to Excel, then create a new excel sheet with a pivot table to display the data held in columns A:P. I get the error message "Run Time error 91: Object variable or with block variable not set" on the "CREATE PIVOT" line below and can't find a way round. Please someone. Help! Option Compare Database
0
1538
by: ravindarjobs | last post by:
Hello friends, I am using ms access 2003, and Vb6. i am displaying a table in a form as pivot table (following "Auto Form: Pivot Table" Wizard) Usually i select the items i want to be displayed in the pivot table by dragging them on to the pivot Table from Pivot Fields. But i got a Problem. My table wil have Columns Dynamically. i mean the colums may increase and decrease from time to time. so my requirement is to display the Updated...
7
1566
by: Dave | last post by:
I'm stuck on something and I've been trying to find some examples on it. I'm trying to show the data to my users as such: year1 year2 Q1 Q2 Q1 Q2 Smith my dataset looks like this: <?xml version="1.0" standalone="yes"?> <NewDataSet>
1
2199
by: mld01s | last post by:
I really need help!!! I dont know if its possible to share pivot tables, or see pivot tables in other machines that the one where the tables were created. This is what happens: I created a database to track different daily results. In a form in that database I added a pivot table, this table lets me see the results, sort them, and everthing a pivot table should let users do. Below the pivot table on the same form I have some fields for...
2
9413
by: Gary Dunne | last post by:
Hi All, I'm struggling to find the correct syntax for creating a Pivot table in an excel file via VB . Net 2005 The Excel help file is not particularly helpful where parameters are concerned (It rarely mentiones the required data types etc) The following is as far as I can get; Dim excelApp As Excel.Application
0
8837
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8728
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9130
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9059
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5977
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3187
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2572
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2129
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.