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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:11:16+00:00 2026-05-24T14:11:16+00:00

I am creating a html page with xslt to format my xml into a

  • 0

I am creating a html page with xslt to format my xml into a html page, however I am getting a value repeated and I can’t find why, below are my xsl, xml, and html. I have indicated where my repeat value occurs directly below, Thanks for everyone’s help!

<fieldset>
    <legend>Joys of a MAD man</legend><ol> 
            Joys of a MAD man *********** Why is the title repeated? ************
           <li>Slow Moving<a href="./Music/Splintz - Joys of a MAD Man/Slow Moving.mp3"> 
          [Download]
          </a></li> 
</ol></fieldset> 

My XML

<albums>
    <album>
        <title>Joys of a MAD man</title>
        <track>Slow Moving</track>
    </album>
    <album>
        <title>Single</title>
        <track>None</track>
    </album>
</albums>

and finally my xsl

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="album">
        <fieldset>
            <legend><xsl:value-of select="title/text()" /></legend>
            <ol>
                <xsl:apply-templates />
            </ol>
        </fieldset>
    </xsl:template>

        <xsl:template match="track">        
           <li>
               <xsl:value-of select="text()" />
               <a>
                   <xsl:attribute name="href">
                   <xsl:text>./Music/Splintz - Joys of a MAD Man/</xsl:text>
                   <xsl:value-of select="text()"/>
                   <xsl:text>.mp3</xsl:text>
               </xsl:attribute>
               [Download]
               </a>
           </li>
         </xsl:template>
</xsl:stylesheet>
  • 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-24T14:11:16+00:00Added an answer on May 24, 2026 at 2:11 pm

    There are built-in default template rules that copy text to the result document.

    <xsl:apply-templates/> is short for <xsl:apply-templates select="child::node()"/>.

    You used xsl:apply-templates inside the template match for album. When you are “standing” on the album element, title is one of the child nodes that get processed.

    The built-in template matched title output it’s text() “Joys of a MAD man” the second time.

    There are a number of ways to prevent the title text from being output the second time. You could:

    • add an empty template matching title to your stylesheet to prevent the built-in template from matching:
      • <xsl:template match="title"/>
    • exclude title from your apply-templates:
      • <xsl:apply-templates select="node()[not(self::title)]"/>
    • only apply-templates to the track child elements:
      • <xsl:apply-templates select="track"/>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a web page, and I can't (with html code) add a draw
I am creating a chunk of HTML/JavaScript with the below code: $result = mysql_query(SELECT
I am creating HTML o/p using xsl. one of the requirement is to display
How to play flv stream in HTML page not specialy creating SWF app? So
How can I display a certain HTML code in a php generated page. For
I'm exploring the XML -> XSLT -> HTML meme for producing web content. I
When creating an HTML page, should I specify things like margin s with pixels
I use Javascript and Mootools for creating a particular HTML page, which includes a
I'm creating a firefox extension and I want to get the HTML page elements
I am creating a html page which contains a question (a puzzle like situation

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.