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

  • SEARCH
  • Home
  • 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 6128053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:34:59+00:00 2026-05-23T16:34:59+00:00

I have an XML file like the following : <?xml version=1.0 encoding=ISO-8859-1 ?> <mylist

  • 0

I have an XML file like the following :

<?xml version="1.0" encoding="ISO-8859-1" ?>
<mylist name="test">
    <title>--$title$- not found</title>
    <table>
        <header>
            <col name="firstname"      title="--$firstname$- not found"/>
            <col name="lastname"      title="--$lastname$- not found"/>
            <col name="country"        title="--$country$- not found"/>
      </header>
            <body>
                <row>
                <col name="firstname">John</col>
                <col name="lastname">Smith</col>
                <col name="country">ENGLAND</col>
              </row>
              <row>
              <col name="firstname">Peter</col>
                <col name="lastname">Scott</col>
                <col name="country">USA</col>
              </row>
        </body>
    </table>
</mylist> 

and I need to show the result as a HTML table like the following :

enter image description here

Could anyone help please? I’m not into XML/XSL and I just need this once

  • 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-23T16:35:00+00:00Added an answer on May 23, 2026 at 4:35 pm

    Try this:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="html"/>
    
      <xsl:template match="mylist">
        <html>
          <xsl:apply-templates />
        </html>
      </xsl:template>
    
      <xsl:template match="title">
        <head>
          <title><xsl:value-of select="." /></title>
        </head>
      </xsl:template>
    
      <xsl:template match="table">
        <table style="border: 1px solid black">
          <xsl:apply-templates />
        </table>
      </xsl:template>
    
      <xsl:template match="header">
        <thead>
          <tr>
            <xsl:apply-templates />
          </tr>
        </thead>
      </xsl:template>
    
      <xsl:template match="body">
        <tbody>
          <xsl:apply-templates />
        </tbody>
      </xsl:template>
    
      <xsl:template match="row">
        <tr>
          <xsl:apply-templates />
        </tr>
      </xsl:template>
    
      <xsl:template match="col[parent::header]">
        <th style="border: solid black 1px;"><xsl:value-of select="@name" /></th>
      </xsl:template>
    
      <xsl:template match="col[parent::row]">
        <td style="border: solid black 1px;"><xsl:value-of select="." /></td>
      </xsl:template>
    </xsl:stylesheet>
    

    It will actually put a style attribute on each <td> or <th> which means the output’s a little verbose, but it keeps the XSLT nice & simple.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following xml file <?xml version=1.0 encoding=utf-8?> <Users> <User> <Name>John Smith</Name> <test>
I have an XML file that looks like <?xml version='1.0' encoding='UTF-8'?> <root> <node name=foo1
I have a XML File like that <?xml version=1.0 encoding=utf-8 ?> <Configurations> <EmailConfiguration> <userName>xxxx</userName>
I have an XML file looks like this: <?xml version=1.0 encoding=utf-8 ?> <PathMasks> <Mask
I have an options_menu.xml file like this: <?xml version=1.0 encoding=utf-8?> <menu xmlns:android=http://schemas.android.com/apk/res/android> <item android:id=@+id/search
I have the following XML file: <xml version=1.0 encoding=utf-8?> <Data> <Parameter1>1</Parameter1> </Data> I want
I have the following mapping file: <?xml version=1.0 encoding=utf-8 ?> <hibernate-mapping xmlns=urn:nhibernate-mapping-2.2 assembly=Project1.Accounts namespace=Project1.Core.Domain>
I have an XML file which looks like this : <?xml version=1.0 encoding=UTF-8?> <resultset
I have an XML/Soap file that looks like this: <?xml version=1.0 encoding=utf-8?> <soap:Envelope xmlns:soap=http://www.w3.org/2003/05/soap-envelope
I have a simple xml file that looks like this: <?xml version=1.0 encoding=UTF-8 standalone=yes

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.