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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:34:52+00:00 2026-05-11T21:34:52+00:00

I am using XSL templates to serve as web page templates for a web

  • 0

I am using XSL templates to serve as web page templates for a web framework, the end output being XHTML 1.0 Strict; it takes XML input and outputs the XHTML. It works perfectly except for one problem – the end output is also outputting a XML node instead of just the contents. Here is the basic XML (missing some items, but the overall design is the same):

<Page>
    <PageScript>
        <Script>./js/myscript.js</Script>
    </PageScript>
    <PageCSS>
        <CSS>./css/mycss.css</CSS>
    </PageCSS>
    <PageContent>Blah blah blah</PageContent>
</Page>

Here is the XSL Template

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:response="http://www.ntforl.com/"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:lang="en">

    <xsl:output
        method="xml"
        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
        doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    />

    <xsl:template match="//PageCSS">
        <xsl:for-each select="CSS">
            <link type="text/css" rel="stylesheet">
                <xsl:attribute name="href">
                    <xsl:value-of select="." />
                </xsl:attribute>
            </link>
        </xsl:for-each>
    </xsl:template>

    <xsl:template match="//PageScript">
        <xsl:for-each select="Script">
            <script type="text/javascript">
                <xsl:attribute name="src">
                    <xsl:value-of select="." />
                </xsl:attribute>
            </script>
        </xsl:for-each>
    </xsl:template>

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()" />
        </xsl:copy>
    </xsl:template>

    <xsl:template match="/" disable-output-escaping="yes">
        <html>
            <head>
                <title>
                    <xsl:value-of select="//PageTitle" />
                </title>
                <meta http-equiv="content-type" content="text/html;charset=utf-8" />
                <link type="text/css" rel="stylesheet" href="template/style/globalStyle.css" />
                <link type="text/css" rel="stylesheet" href="template/style/standards.css" />
                <xsl:apply-templates select="//PageCSS" />
                <script type="text/javascript" src="template/js/some_file.js"></script>
                <xsl:apply-templates select="//PageScript" />
            </head>
            <body onload="">
                <div id="container">
                    <div id="top">
                        <div class="clear" />
                    </div>
                    <div id="main">
                        <div class="left" style="width: 708px; margin-top: 10px;">
                            <h1 class="center">
                                <xsl:value-of select="//PageTitle" />
                            </h1>
                        </div>
                        <div class="clear" />
                        <div id="rightPane">
                            <div id="rightPaneContent">
                                <xsl:apply-templates select="//PageContent" />
                            </div>
                            <img src="template/images/mainBgBottom.png" alt="" />
                        </div>
                    </div>
                </div>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>

The problem resides in the PageContent, and it only happens with the PageContent. When the transformation is run, the template outputs

<PageContent xmlns=""> node content </PageContent>

in the XHTML. I need to know how to get rid of it so I can have a valid XHTML 1.0 Strict document.

The weird thing is that the PageContent node is the only node to do this, no other node gets it content wrapped with the node name in the output. What is the reason for this behaviour?

  • 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-11T21:34:52+00:00Added an answer on May 11, 2026 at 9:34 pm

    I would try replacing <xsl:apply-templates select="//PageContent" /> with:

    <xsl:apply-templates select="//PageContent/node()" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

we're currently generating all our official documents using XSL-FO transformation using .xml files as
How do you add a page break into a document with XSL-FO? I'm using
i use the following XSLT by using XMLSpy: <?xml version=1.0 encoding=UTF-16?> <xsl:stylesheet version=2.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform
I have the following xsl template that I'm using to group my xsl. The
I am trying to get some xpath from xsl variable using xsl ver 1.0
I was using an XSL style sheet to do the sorting but it seems
I use this code to transform XML to HTML using XSLT template: string uri
I'm working with XSL templates in Java, and I'm trying to build a custom
I am having a problem trying to sort with an XSL file using the
Using online interfaces to a version control system is a nice way to have

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.