Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7521699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:18:10+00:00 2026-05-30T02:18:10+00:00

I have an multiple entities ( <data> in my example) with key-value pairs. Every

  • 0

I have an multiple entities (<data> in my example) with key-value pairs. Every entity contains the same keys in the same order, but I don’t know which and how many. How to transform this to a HTML table using XSLT, having the keys in the table headers and the values of the entities in the table rows?

<data>
  <entry>
     <key>id</key><value>12345</value>
  </entry>
  <entry>
     <key>price</key><value>12.45</value>
  </entry>
  <entry>
      <key>country</key><value>UK</value>
  </entry>
<data>
<data>
  <entry>
     <key>id</key><value>67890</value>
  </entry>
  <entry>
     <key>price</key><value>67.89</value>
  </entry>
  <entry>
      <key>country</key><value>DE</value>
  </entry>
<data>

… should become …

<tr><th>id</th><th>price</th><th>country</th></tr>
<tr><td>12345</td><td>12.45</td><td>UK</td></tr>
<tr><td>67890</td><td>67.89</td><td>DE</td></tr>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T02:18:11+00:00Added an answer on May 30, 2026 at 2:18 am

    Use:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
        <xsl:output method="xml" indent="yes"/>
    
        <xsl:template match="/">
            <table>
                <tr>
                    <xsl:for-each select="//data[1]/entry">
                        <th>
                            <xsl:value-of select="key"/>
                        </th>
                    </xsl:for-each>
                </tr>
    
                <xsl:apply-templates select="//data"/>
            </table>
        </xsl:template>
    
        <xsl:template match="data">
            <tr>
                <xsl:apply-templates select="entry"/>
            </tr>
        </xsl:template>
    
        <xsl:template match="entry">
            <td>
                <xsl:value-of select="value"/>
            </td>
        </xsl:template>
    </xsl:stylesheet>
    

    Output:

    <table>
      <tr>
        <th>id</th>
        <th>price</th>
        <th>country</th>
      </tr>
      <tr>
        <td>12345</td>
        <td>12.45</td>
        <td>UK</td>
      </tr>
      <tr>
        <td>67890</td>
        <td>67.89</td>
        <td>DE</td>
      </tr>
    </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It is possible to have one NSManagedObject subclass represent multiple Core Data entities. For
I want to share same Database information across multiple entities in Silverlight.. but I
I have an application with multiple "pick list" entities, such as used to populate
I have multiple selects: <select id=one> <option value=1>one</option> <option value=2>two</option> <option value=3>three</option> </select> <select
I have multiple business entities in VB.NET Windows Forms application. Right now they are
I have an Order table. An Order can have multiple items in it, with
OK so I have two entities in my data model (let's say entityA and
I have an asp.net mvc application with three layers: - data layer with entities
I'm currently facing in problem using Core Data. I have two entities A and
I have an asp.net page with many dozens of controls representing multiple database entities.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.