Question about create pivot table in xslt

Discussion in 'XML' started by Lee, Jun 1, 2007.

  1. Lee

    Lee Guest

    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.
    Lee, Jun 1, 2007
    #1
    1. Advertising

  2. 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 <td> elements.) 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 <tr> element.)

    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 <table> element.)



    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Jun 1, 2007
    #2
    1. Advertising

  3. Lee

    Lee Guest

    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 <> wrote:
    > 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 <td> elements.) 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 <tr> element.)
    >
    > 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 <table> element.)
    >
    > --
    > () ASCII Ribbon Campaign | Joe Kesselman
    > /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Lee, Jun 1, 2007
    #3
  4. 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
    Joe Kesselman, Jun 1, 2007
    #4
  5. Lee

    Lee Guest

    On May 31, 5:33 pm, Joe Kesselman <> wrote:
    > 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.
    Lee, Jun 1, 2007
    #5
  6. Lee

    Lee Guest

    On May 31, 5:33 pm, Joe Kesselman <> wrote:
    > 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!
    Lee, Jun 1, 2007
    #6
  7. Lee

    Lee Guest

    On May 31, 6:55 pm, Lee <> wrote:
    > On May 31, 5:33 pm, Joe Kesselman <> wrote:
    >
    >
    >
    >
    >
    > > 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.
    Lee, Jun 1, 2007
    #7
  8. > 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
    Joe Kesselman, Jun 1, 2007
    #8
  9. 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
    Joe Kesselman, Jun 1, 2007
    #9
  10. See:

    http://www.topxml.com/code/default.asp?p=3&id=v20010226151246


    Cheers,
    Dimitre Novatchev


    "Lee" <> wrote in message
    news:...
    >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.
    >
    Dimitre Novatchev, Jun 1, 2007
    #10
  11. Lee

    Lee Guest

    On Jun 1, 5:59 am, "Dimitre Novatchev" <> wrote:
    > See:
    >
    > http://www.topxml.com/code/default.asp?p=3&id=v20010226151246
    >
    > Cheers,
    > Dimitre Novatchev
    >
    > "Lee" <> wrote in message
    >
    > news:...
    >
    >
    >
    > >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!
    Lee, Jun 1, 2007
    #11
  12. Lee

    Lee Guest

    On Jun 1, 5:59 am, "Dimitre Novatchev" <> wrote:
    > See:
    >
    > http://www.topxml.com/code/default.asp?p=3&id=v20010226151246
    >
    > Cheers,
    > Dimitre Novatchev
    >
    > "Lee" <> wrote in message
    >
    > news:...
    >
    >
    >
    > >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.
    Lee, Jun 1, 2007
    #12
  13. Lee

    Lee Guest

    On Jun 1, 11:33 am, Lee <> wrote:
    > On Jun 1, 5:59 am, "Dimitre Novatchev" <> wrote:
    >
    >
    >
    >
    >
    > > See:

    >
    > > http://www.topxml.com/code/default.asp?p=3&id=v20010226151246

    >
    > > Cheers,
    > > Dimitre Novatchev

    >
    > > "Lee" <> wrote in message

    >
    > >news:...

    >
    > > >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:eek:utput 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>
    Lee, Jun 2, 2007
    #13
  14. > 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/05/exslt-node-set-function.html

    Cheers,
    Dimitre Novatchev

    "Lee" <> wrote in message
    news:...
    > On Jun 1, 5:59 am, "Dimitre Novatchev" <> wrote:
    >> See:
    >>
    >> http://www.topxml.com/code/default.asp?p=3&id=v20010226151246
    >>
    >> Cheers,
    >> Dimitre Novatchev
    >>
    >> "Lee" <> wrote in message
    >>
    >> news:...
    >>
    >>
    >>
    >> >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 Novatchev, Jun 2, 2007
    #14
  15. Lee

    Lee Guest

    On Jun 1, 11:33 pm, "Dimitre Novatchev" <> wrote:
    > > 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/05/exslt-node-set-function.html
    >
    > Cheers,
    > Dimitre Novatchev
    >
    > "Lee" <> wrote in message
    >
    > news:...
    >
    >
    >
    > > On Jun 1, 5:59 am, "Dimitre Novatchev" <> wrote:
    > >> See:

    >
    > >> http://www.topxml.com/code/default.asp?p=3&id=v20010226151246

    >
    > >> Cheers,
    > >> Dimitre Novatchev

    >
    > >> "Lee" <> wrote in message

    >
    > >>news:...

    >
    > >> >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.
    Lee, Jun 7, 2007
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QWpheQ==?=

    Create Pivot table

    =?Utf-8?B?QWpheQ==?=, Feb 13, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    7,456
    Alvin Bruney [MVP]
    Feb 16, 2004
  2. =?Utf-8?B?UG9udGlNYXg=?=

    Pivot table control

    =?Utf-8?B?UG9udGlNYXg=?=, Jun 15, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    4,374
    Ken Cox [Microsoft MVP]
    Jun 15, 2004
  3. Phil Winstanley [Microsoft MVP ASP.NET]

    Re: Pivot table control

    Phil Winstanley [Microsoft MVP ASP.NET], Jun 15, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    363
    Phil Winstanley [Microsoft MVP ASP.NET]
    Jun 15, 2004
  4. Phil Winstanley [Microsoft MVP ASP.NET]

    Re: Pivot table control

    Phil Winstanley [Microsoft MVP ASP.NET], Jun 15, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    420
    Kevin Spencer
    Jun 15, 2004
  5. Replies:
    18
    Views:
    756
Loading...

Share This Page