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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:38:10+00:00 2026-05-27T20:38:10+00:00

Say I have XMLise the book The Complete Reference – Java . Now instead

  • 0

Say I have XMLise the book The Complete Reference – Java. Now instead of writing the contents of the book, I (rather everybody) would like to generate it from the tags. So..

Following is the XML structure –

<Books>
  <Book>
   <Part n="1" h="The Java Language">
    <SubHead h="Basics">
     <Topic n="1" h="The History and Evolution of Java">
     .....
     </Topic>
     <Topic n="2" h="An overview of Java">
     .....
     </Topic>
     <Topic n="3" h="Data Types, Variables, and Arrays">
     .....
     </Topic>
    </SubHead>
    <SubHead h="Intermediate">
     <Topic n="4" h="Operators">
     .....
     </Topic>
     <Topic n="5" h="Control Statements">
     .....
     </Topic>
     <Topic n="6" h="Looping">
     .....
     </Topic>
    </SubHead>
   </Part>
   <Part n="2" h="OOPS">
    <SubHead h="Basics">
     <Topic n="7" h="Introduction to Classes">
     .....
     </Topic>
     <Topic n="8" h="Inheritance">
     .....
     </Topic>
    </SubHead>
    <SubHead h="Intermediate">
     <Topic n="8" h="Packages and Interfaces">
     .....
     </Topic>
     <Topic n="9" h="Exception Handling">
     .....
     </Topic>
    </SubHead>
   </Part>
 </Book>
</Books>

The dotted lines means the content of the book. Now How to get the following output in HTML, along with the detailed description of the contents of the Topic Tag. I mean to say that, I am looking for the Content section of any book.

Part 1 - The Java Language
   Basics
      1. The History and Evolution of Java
      2. An overview of Java
      3. Data Types, Variable, and Arrays
   Intermediate
      4. Operators
      5. Control Statements
      6. Looping
Part 2 - OOPS
   Basics
      7. Introduction to Classes
      8. Inheritance
   Intermediate
      9. Packages and Interfaces
      10. Exception Handling
  • 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-27T20:38:11+00:00Added an answer on May 27, 2026 at 8:38 pm

    Following Xsl gives you an output data you’re asking:

    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="html"/>
    
        <xsl:template match="Book" >
            <xsl:apply-templates/>
        </xsl:template>
    
        <xsl:template match="Part" >
            Part <xsl:value-of select="@n"/> - <xsl:value-of select="@h"/>
            <xsl:apply-templates/>
        </xsl:template>
    
        <xsl:template match="SubHead">
            <xsl:value-of select="@h"/>
            <xsl:apply-templates/>
        </xsl:template>
    
        <xsl:template match="Topic" >
            <xsl:value-of select="@n"/>. <xsl:value-of select="@h"/>
        </xsl:template>
    </xsl:stylesheet>
    

    The output will be:

    Part 1 - The Java Language
            Basics
                1. The History and Evolution of Java
                2. An overview of Java
                3. Data Types, Variables, and Arrays
    
            Intermediate
                4. Operators
                5. Control Statements
                6. Looping
    
    
    
    Part 2 - OOPS
            Basics
                7. Introduction to Classes
                8. Inheritance
    
            Intermediate
                8. Packages and Interfaces
                9. Exception Handling
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a higher kinded type SuperMap[Key[_],Value[_]]`. Suppose now that I had something
Say I have a very simple java object that only has some getXXX and
Say I have a java PriorityQueue (which java implements as a heap) that I
Say I have below lines any in a Java class, System.out.println(start); if(true)//The compiler will
Lets say have this immutable record type: public class Record { public Record(int x,
Let's say have something like: SELECT energy_produced, energy_consumed, timestamp1 AS timestamp FROM ( SELECT
Say we have the following method: private MyObject foo = new MyObject(); // and
Say I have the following file structure: app/ app.py controllers/ __init__.py project.py plugin.py If
Say you have an application divided into 3-tiers: GUI, business logic, and data access.
Say I have an ASMX web service, MyService. The service has a method, MyMethod.

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.