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 931949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:35:06+00:00 2026-05-15T20:35:06+00:00

My XML is <row> <entry>1.</entry> <entry>foo</entry> <entry>morefoo</entry> </row> <row> <entry>2.</entry> <entry>2foo</entry> <entry>2morefoo</entry> </row> using

  • 0

My XML is

<row>
  <entry>1.</entry>
  <entry>foo</entry>
  <entry>morefoo</entry>
</row>
<row>
  <entry>2.</entry>
  <entry>2foo</entry>
  <entry>2morefoo</entry>
</row>

using XSLT, i’m trying to represent this information in a html table, and i want to have a Serial no. column.

How do i go about selecting the value of only the first ‘entry’ tag?

  • 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-15T20:35:07+00:00Added an answer on May 15, 2026 at 8:35 pm

    In your XSLT you should have something like this:

    <!-- matches the root (not specified in your post) -->
    <xsl:template match="/">
       <!-- at root level, make your table -->
       <table>
         <thead>.... </thead>
         <tbody>
           <!-- push the rows through, make sure the path is correct -->
           <xsl:apply-templates select="path/to/row" />
         </tbody>
       </table>
    </xsl:template>
    
    <xsl:template match="row">
       <!-- create the rows -->
       <tr>
         <!-- process first entry only, as you requested (why?) -->
         <xsl:apply-templates select="entry[1]" mode="first"/>
         <!-- process other entries -->
         <xsl:apply-templates select="entry[position() > 1]" mode="other"/>
       </tr>
    </xsl:template>
    
    <xsl:template match="entry" mode="first">
       <!-- maybe you want the first cell to be treated specially, i.e. as row header -->
       <th><xsl:value-of select="."/></th>
    </xsl:template>
    
    <xsl:template match="entry" mode="other">
       <!-- the other cells -->
       <td><xsl:value-of select="."/></td>
    </xsl:template>
    

    Note: the code above is not tested, use it as a template for your own real code and data.

    Output would be something like the following:

    <table>
      <thead>....</thead>
      <tbody>
        <tr>
          <th>1.</th>
          <td>foo</td>
          <td>morefoo</td>
        </tr>
        <tr>
          <th>2.</th>
          <td>2foo</td>
          <td>2morefoo</td>
        </tr>
        <tr>....
      </tbody>
    </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is what I'm trying to do in XSL: <xsl:apply-templates select=document('a.xml')//row/> <xsl:apply-templates select=document('b.xml')//row/> <xsl:template
I setup a listview with a layout XML for each row: this.setContentView(R.layout.item_view); ListView m_ListView
I have XML that looks like this: <ROW ref=0005631 type=04 line=1 value=Australia/> <ROW ref=0005631
Normally the XML files I have to parse are like this: <row id=1> <title>widget<title>
I have some xml like this: <Data> <Rows> <Row> <Field Name=title>Mr</Field> <Field Name=surname>Doe</Field> <Row>
I'm trying to do a easy dynamic <table> with an input XML. My XML
I'm trying to add a ProgressBar to my row.xml view but I can't seem
Hi guys I'm trying to parse an xml document using jquery but i keep
I am currently using sql.row(statement) and storing to a list. I then am trying
Using e4x in flex: var attr : String = foo; var xml : XML

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.