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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:14:34+00:00 2026-05-10T19:14:34+00:00

I’m exploring the XML -> XSLT -> HTML meme for producing web content. I

  • 0

I’m exploring the XML -> XSLT -> HTML meme for producing web content. I have very little XSLT experience.

I’m curious what mechanisms are available in XSLT to handle abstractions or ‘refactoring’.

For example, with generic HTML and a service side include, many pages can be templated and decomposed to where there are, say, common header, nav, and footer segments, and the page itself is basically the body.

The common markup languages, JSP, PHP, ASP, go as far as to allow all of those segments to have dynamic content (such as adding the user name to every header block).

JSP goes even farther by allowing you to create Tag files, which can accept arguments to be used when generating the content, and even surround and work on content within the tags themselves.

I’m curious similar functionality is done within XSLT. What facilities are there to make reusable block of XSLT for things like creating HTML pages?

  • 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. 2026-05-10T19:14:35+00:00Added an answer on May 10, 2026 at 7:14 pm

    For my own project, this is how I divided up my pages. There was a template.xsl file which was imported by each of my XSLs. Most pages just had template.xsl, but some pages such as cart, etc. needed their own because of the different kind of data they were parsing.

    <page title='Home'>     <navigation>         <!-- something here -->     </navigation>     <main>         <!-- something here -->     </main> </page> 

    This is a snippet from my template.xsl. I threw in all the common stuff in here, and then gave the opportunity for my pages to add their own information through call-template.

    <xsl:template match='/page' name='page'>       <html>     <head>           <title><xsl:value-of select='(@title)' /></title>                    <xsl:call-template name='css' />         <xsl:call-template name='script' />     </head>     <body>         <xsl:call-template name='container' />     </body>     </html> </xsl:template> 

    An example of how my css tag would respond. Note that it calls css-extended. css only had the the common css’ that would apply across all pages. Some pages needed more. Those could override css-extended. Note that is needed because call-template will fail if a page calls a template but doesn’t define it anywhere.

       <xsl:template name='css'>         <link rel='stylesheet' type='text/css' href='{$cssPath}reset.css'  />         <link rel='stylesheet' type='text/css' href='{$cssPath}style.css'  />         <link rel='stylesheet' type='text/css' href='{$cssPath}layout.css' />         <xsl:call-template name='css-extended' />     </xsl:template>         <!-- This is meant to be blank. It gets overriden by implementing stylesheets -->     <xsl:template name='css-extended' /> 

    My container would work in a similar manner– common stuff was defined and then each page could just provide an implementation. A default implementation was in the XSL. (in content)

      <xsl:template name='container'>         <div id='container'>             <xsl:call-template name='header' />             <xsl:call-template name='content' />             <xsl:call-template name='footer' />         </div>     </xsl:template>        <xsl:template name='content'>         <div id='content'>             <div id='content-inner'>                 <xsl:call-template name='sideBar' />                 <xsl:call-template name='main' />             </div>         </div>     </xsl:template>         <xsl:template name='main'>         <div id='main'>             <xsl:apply-templates select='main' />             <xsl:call-template name='main-extended' />        </div>     </xsl:template>      <!-- This is meant to be blank. It gets overriden by implementing stylesheets -->     <xsl:template name='main-extended' />  <xsl:template name='footer'>         <div id='footer'>         <div id='footer-inner'>         <!-- Footer content here -->         </div>         </div> </xsl:template>   

    It worked quite beautifully for me. If there are any questions I can answer for you, let me know.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 87k
  • Answers 87k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I originally asked how to write binary data to a… May 11, 2026 at 5:33 pm
  • Editorial Team
    Editorial Team added an answer I would suggest to break the file into blocks. All… May 11, 2026 at 5:33 pm
  • Editorial Team
    Editorial Team added an answer Short answer: no. Long answer: See http://svnbook.red-bean.com/en/1.5/svn.advanced.sparsedirs.html and do your… May 11, 2026 at 5:33 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.