SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Member
    Join Date
    Feb 2014
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation XSLT 1.0: Creating A Table with XSLT & Multiple Values To Concatenate

    Hello,

    I've run into a roadblock and I'm hoping someone can help me. I am trying to create a table using xslt 1.0. I've searched around and found posts on using for loops with xslt key and generate-id. None of them seem to address all the issues I have with empty tables matching up to a column and concatenating multiple values together in one cell. The xml structure is the following and cannot be changed:

    Code XML:
    <Document>
    <Records>
      <User>
        <Name>User1</Name>
        <list xid="data.set">
          <Data>
            <Column>2</Column>
            <Type>Carbs</Type>
            <RowValue>Oatmeal</RowValue>
          </Data>
          <Data>
            <Column>1</Column>
            <Type>Protein</Type>
            <RowValue>sausage</RowValue>
            <RowValue>eggs</RowValue>
            <RowValue>turkey</RowValue>
          </Data>
        </list>
      </User>
      <User>
        <Name>User2</Name>
        <list xid="data.set">
          <Data>
            <Type>Vegetables</Type>
            <Column>8</Column>
            <RowValue>Squash</RowValue>
          </Data>
          <Data>
            <Column>3</Column>
            <Type>Sweets</Type>
            <RowValue>cake</RowValue>
            <RowValue>cookies</RowValue>
          </Data>
          <Data>
            <Column>5</Column>
            <Type>Other</Type>
          </Data>
          <Data>
            <Column>6</Column>
            <Type>Beverage</Type>
            <RowValue>grape juice</RowValue>
          </Data>
        </list>
        </User>
      <User>
        <Name>User3</Name>
        <list xid="data.set">
            <Data>
              <Column>7</Column>
              <Type>Fats</Type>
              <RowValue>cashews</RowValue>
            </Data>
            <Data>
              <Column>8</Column>
              <Type>Vegetables</Type>
              <RowValue>Green Beans</RowValue>
            </Data>
            <Data>
              <Column>2</Column>
              <Type>Carbs</Type>
              <RowValue>Brown Rice</RowValue>
            </Data>
          </list>
        </User>
        <User>
          <Name>User5</Name>
          <list xid="data.set">
            <Data>
              <Column>3</Column>
              <Type>Sweets</Type>
              <RowValue>gummy worms</RowValue>
            </Data>
            <Data>
              <Column>4</Column>
              <Type>Fruit</Type>
              <RowValue>apples</RowValue>
            </Data>
          </list>
        </User>
        <User>
          <list xid="data.set">
            <Name>User6</Name>
            <Data>
              <Column>3</Column>
              <Type>Sweets</Type>
              <RowValue>gummy worms</RowValue>
            </Data>
            <Data>
              <Column>4</Column>
              <Type>Fruit</Type>
              <RowValue>grapes</RowValue>
            </Data>
          </list>
        </User>
    </Records>
    </Document>

    I need to this to display in a table like the one below. Also, please notice that I need to be able to concatenate multiple values in a table cell as well. I.e. for User1: sausage, eggs and turkey needs to be concatenated under the "protein" column.

    Name Protein Carbs Sweets Fruits Other Beverages Fats Vegetables
    User1 Sausage, eggs, turkey Oatmeal
    User2 cookies, cakes grape juice Squash
    User3 Brown Rice Cashews Green Beans
    User4 gummy worms apples
    User5 gummy worms grapes
    Last edited by Mittineague; Feb 12, 2014 at 15:34. Reason: reformatting bbcode tags


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •