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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:08:38+00:00 2026-06-08T22:08:38+00:00

I have transformed an XHTML file into other XHTML file with XSLT. It has

  • 0

I have transformed an XHTML file into other XHTML file with XSLT. It has been successfully transformed and the output looks the same as the desired one but the transformed output doesn’t display anything when its opened in the browser and in dreamweaver also the color of all the tags remain black from </head> tag onward instead of usual multi-colors. Find the screen shot of my output attached and also my code. Please help me out to sort out this problem.
Thanking you!

Input File

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 11 February 2007), see www.w3.org" />
  <meta http-equiv="Content-type" content="text/html; charset=us-ascii" />
  <script type="t/j" src="abc.js">
</script>
  <title></title>
</head>
<body>
  <div id="o">
    <div id="m">
      <div id="nD">
        <p id="nT">Part 1</p>
      </div>

      <div class="TF" id="123">
        <script type="t/j" src="xyz.js"></script>
        <script type="t/j" src="abc.js"></script>

        <div class="iD">
          <img alt="" src="ic.gif" /> <span class="iDe">ABC</span><br />

          <div class="iDev">
            <div id="ta12" class="bl" style="dis:bl"></div>

            <div class="q">
              <div id="t0b" class="block">
                1<span style="color">TEXT1</span>
              </div><br />
              T <input type="radio" name="o0" id="t0" onclick="getFeedback()" /> 
              F <input type="radio" name="op0" id="f0" onclick="getFeedback()" />

              <div id="18">C</div>
              <div id="sfb"></div>
            </div><br />
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
</html>

My XSLT:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="xhtml">
  <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
  <xsl:strip-space elements="*"/>
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="xhtml:body">
    <script type="t/j" src="pqr.js" xml:space="preserve"/>
    <script type="t/j" src="stu.js" xml:space="preserve"/>
    <body onload="loadPage()" onunload="unloadPage()">
      <xsl:apply-templates select="@*|node()"/>
    </body>
  </xsl:template>
  <xsl:template match="xhtml:div[@id='123']/@*">
    <xsl:attribute name="class">QT</xsl:attribute>
    <xsl:attribute name="id">456</xsl:attribute>
  </xsl:template>
  <xsl:template match="xhtml:script[@src='xyz.js']">
    <xsl:copy>
      <xsl:apply-templates select="@*[not(@src)]"/>
      <xsl:attribute name="src">lmn.js</xsl:attribute>
      <xsl:apply-templates select="node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="xhtml:body//xhtml:script[@src='abc.js']"/>
  <xsl:template match="@onclick"/>
  <xsl:template match="xhtml:body//xhtml:div[@id='19']"/>
  <xsl:template match="xhtml:div[@class='iD']">
    <form name="form">
      <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
      <xsl:apply-templates select="following-sibling::xhtml:div[1]" mode="inside-form"/>
      <br/>
      <input type="submit" name="sub" value="Done"/>
    </form>
  </xsl:template>
  <xsl:template match="xhtml:div[@id='ta12']">
    <xsl:copy>
      <xsl:attribute name="class">pa</xsl:attribute>
      <xsl:attribute name="value">10</xsl:attribute>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="xhtml:div[@id='t0b']">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:attribute name="id">ta0b8</xsl:attribute>
      <xsl:apply-templates select="node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="xhtml:input[@name='o0']">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:attribute name="name">key0b8</xsl:attribute>
      <xsl:attribute name="class">block</xsl:attribute>
      <xsl:apply-templates select="node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="xhtml:input[@name='op0']">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:attribute name="name">key0b8</xsl:attribute>
      <xsl:attribute name="class">block</xsl:attribute>
      <xsl:apply-templates select="node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

Output Screenshot-

Output of the code

Please see in the above image all the tags are in black from closing head tag onward and also the design section is blank.

  • 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-06-08T22:08:39+00:00Added an answer on June 8, 2026 at 10:08 pm

    I get output if I change:

      <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
    

    to:

      <xsl:output method="html" indent="yes" encoding="UTF-8"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML file which has to be transformed using XSLT, I am
I have transformed one XML file to an another XML file (in desired structure)
we have XSLT to transform XML into HTML in XHTML 1.0 Strict in XSLT
I have an XML(XHTML) file which I'm transforming into another XML file by using
I have a very complicated site built on CSS3 that has html elements 3d-transformed,
Is it possible to use XSLT to transform XML into something other than XML?
I'm using XSLT and need to generate the doctype dynamically in the transformed output,
I have the following xsl stylesheet: <xsl:stylesheet xmlns=http://www.w3.org/1999/xhtml xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output method=xml encoding=utf-8/> <xsl:template match=/>
I have been trying to create rotating object using jQuery and without any other
I have a simply XSLT 1.0 stylesheet, that turns XML documents in XHTML. I

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.