468,483 Members | 2,559 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,483 developers. It's quick & easy.

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>Height</SpecLabel>
<SpecValue>10</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>6</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</SpecLabel>
<SpecValue>20.5</SpecValue>
<SpecCat>Weigth</SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="2">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>8</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</SpecLabel>
<SpecValue>18</SpecValue>
<SpecCat>Weigth</SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="3">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>2</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</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 4697
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
"Transforming 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
"Transforming 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
"Transforming 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
"Transforming 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.googlegr oups.com...
>I have a xml file, here is sample part:
<?xml version="1.0" encoding="UTF-8"?>
<ProducsList>
<Product id="1">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>10</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>6</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</SpecLabel>
<SpecValue>20.5</SpecValue>
<SpecCat>Weigth</SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="2">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>8</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</SpecLabel>
<SpecValue>18</SpecValue>
<SpecCat>Weigth</SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="3">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>2</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</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
Lee
On Jun 1, 5:59 am, "Dimitre Novatchev" <dimit...@tpg.com.auwrote:
See:

http://www.topxml.com/code/default.a...20010226151246

Cheers,
Dimitre Novatchev

"Lee" <lee.jenkins...@gmail.comwrote in message

news:11**********************@p77g2000hsh.googlegr oups.com...
I have a xml file, here is sample part:
<?xml version="1.0" encoding="UTF-8"?>
<ProducsList>
<Product id="1">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>10</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>6</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</SpecLabel>
<SpecValue>20.5</SpecValue>
<SpecCat>Weigth</SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="2">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>8</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</SpecLabel>
<SpecValue>18</SpecValue>
<SpecCat>Weigth</SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="3">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>2</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</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.- Hide quoted text -

- Show quoted text -
Dimitre,

Thank you very much for the reply. actually, I did find your page
yesterday by google, but for some reason I could not open it
yesterday, I am checking it right now. Thanks a lot!

Jun 1 '07 #11
Lee
On Jun 1, 5:59 am, "Dimitre Novatchev" <dimit...@tpg.com.auwrote:
See:

http://www.topxml.com/code/default.a...20010226151246

Cheers,
Dimitre Novatchev

"Lee" <lee.jenkins...@gmail.comwrote in message

news:11**********************@p77g2000hsh.googlegr oups.com...
I have a xml file, here is sample part:
<?xml version="1.0" encoding="UTF-8"?>
<ProducsList>
<Product id="1">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>10</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>6</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</SpecLabel>
<SpecValue>20.5</SpecValue>
<SpecCat>Weigth</SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="2">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>8</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</SpecLabel>
<SpecValue>18</SpecValue>
<SpecCat>Weigth</SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="3">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>2</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</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.- Hide quoted text -

- Show quoted text -
Dimitre,

I found you are using msxsl namespace, is that gonna be a problem for
none-microsoft browsers? Thanks.

Jun 1 '07 #12
Lee
On Jun 1, 11:33 am, Lee <lee.jenkins...@gmail.comwrote:
On Jun 1, 5:59 am, "Dimitre Novatchev" <dimit...@tpg.com.auwrote:


See:
http://www.topxml.com/code/default.a...20010226151246
Cheers,
Dimitre Novatchev
"Lee" <lee.jenkins...@gmail.comwrote in message
news:11**********************@p77g2000hsh.googlegr oups.com...
>I have a xml file, here is sample part:
<?xml version="1.0" encoding="UTF-8"?>
<ProducsList>
<Product id="1">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>10</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>6</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</SpecLabel>
<SpecValue>20.5</SpecValue>
<SpecCat>Weigth</SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="2">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>8</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</SpecLabel>
<SpecValue>18</SpecValue>
<SpecCat>Weigth</SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="3">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>2</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</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.- Hide quoted text -
- Show quoted text -

Dimitre,

I found you are using msxsl namespace, is that gonna be a problem for
none-microsoft browsers? Thanks.- Hide quoted text -

- Show quoted text -
Thank you guys, I finially figured out how to do it. at the very
beginning I thought I can't use param in for-each, so I don't event
try to use variable, acutually, variable is OK to use in for-each
loop. so my xslt file is here:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xsl:output method="html" />
<xsl:template match="/">
<html>
<body>
<table border="1">
<xsl:for-each select="/ProductList/Product[position()=1]/SpecList/
Spec">
<xsl:variable name="label" select="SpecLabel"></xsl:variable>
<tr>
<td>
<xsl:value-of select="$label"/>
</td>

<xsl:for-each select="/ProductList/Product">
<td>
<xsl:apply-templates select="SpecList/Spec/SpecLabel[.=
$label]"/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>

<xsl:template match="SpecLabel">
<xsl:value-of select="../SpecValue"/>
</xsl:template>

</xsl:stylesheet>

Jun 2 '07 #13
Dimitre,
>
I found you are using msxsl namespace, is that gonna be a problem for
none-microsoft browsers? Thanks.
No, but for another processor one would normally use the exslt:node-set()
extension function instead.

Just a few days ago Julian Reschke and David Carlisle discovered a
technique, which allows to specify exslt:node-set() in a way that it can be
used with the MSXML xslt processor:

http://dpcarlisle.blogspot.com/2007/...-function.html

Cheers,
Dimitre Novatchev

"Lee" <le************@gmail.comwrote in message
news:11**********************@u30g2000hsc.googlegr oups.com...
On Jun 1, 5:59 am, "Dimitre Novatchev" <dimit...@tpg.com.auwrote:
>See:

http://www.topxml.com/code/default.a...20010226151246

Cheers,
Dimitre Novatchev

"Lee" <lee.jenkins...@gmail.comwrote in message

news:11**********************@p77g2000hsh.googleg roups.com...
>I have a xml file, here is sample part:
<?xml version="1.0" encoding="UTF-8"?>
<ProducsList>
<Product id="1">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>10</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>6</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</SpecLabel>
<SpecValue>20.5</SpecValue>
<SpecCat>Weigth</SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="2">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>8</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</SpecLabel>
<SpecValue>18</SpecValue>
<SpecCat>Weigth</SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="3">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>2</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</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.- Hide quoted text -

- Show quoted text -

Jun 2 '07 #14
Lee
On Jun 1, 11:33 pm, "Dimitre Novatchev" <dimit...@tpg.com.auwrote:
Dimitre,
I found you are using msxsl namespace, is that gonna be a problem for
none-microsoft browsers? Thanks.

No, but for another processor one would normally use the exslt:node-set()
extension function instead.

Just a few days ago Julian Reschke and David Carlisle discovered a
technique, which allows to specify exslt:node-set() in a way that it can be
used with the MSXML xslt processor:

http://dpcarlisle.blogspot.com/2007/...-function.html

Cheers,
Dimitre Novatchev

"Lee" <lee.jenkins...@gmail.comwrote in message

news:11**********************@u30g2000hsc.googlegr oups.com...
On Jun 1, 5:59 am, "Dimitre Novatchev" <dimit...@tpg.com.auwrote:
See:
http://www.topxml.com/code/default.a...20010226151246
Cheers,
Dimitre Novatchev
"Lee" <lee.jenkins...@gmail.comwrote in message
>news:11**********************@p77g2000hsh.googleg roups.com...
I have a xml file, here is sample part:
<?xml version="1.0" encoding="UTF-8"?>
<ProducsList>
<Product id="1">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>10</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>6</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</SpecLabel>
<SpecValue>20.5</SpecValue>
<SpecCat>Weigth</SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="2">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>8</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</SpecLabel>
<SpecValue>18</SpecValue>
<SpecCat>Weigth</SpecCat>
</Spec>
</SpecList>
</Prodcut>
<Product id="3">
<SpecList>
<Spec>
<SpecLabel>Height</SpecLabel>
<SpecValue>5</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Width</SpecLabel>
<SpecValue>2</SpecValue>
<SpecCat>Dimension</SpecCat>
</Spec>
<Spec>
<SpecLabel>Weight</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.- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -
Dimitre,

Thanks a lot for the help. It is an interesting article. Thanks.

Jun 7 '07 #15

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Rob | last post: by
4 posts views Thread by Ajay | last post: by
9 posts views Thread by PeteCresswell | last post: by
2 posts views Thread by LittlePhil via AccessMonster.com | last post: by
7 posts views Thread by Dave | last post: by
2 posts views Thread by Gary Dunne | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.