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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:57:03+00:00 2026-05-15T20:57:03+00:00

I am trying to basically recreate the functionality of an ASP.NET master page with

  • 0

I am trying to basically recreate the functionality of an ASP.NET master page with an XSLT template.

I have a “master page” template that contains much of the page html stored in an .xslt file. I have another .xslt file specific to a single page, that takes in xml representing the page data. I want to call the master page template from my new template, and still have the ability to insert my own xml that will be applied. If I could pass a param that would allow me to call template with the param as the name, that would do the trick, but that doesn’t appear to be allowed.

Basically I have this:

<xsl:template name="MainMasterPage">
  <xsl:with-param name="Content1"/>
  <html>
    <!-- bunch of stuff here -->
    <xsl:value-of select="$Content1"/>
  </html>
</xsl:template>

And this:

<xsl:template match="/">
  <xsl:call-template name="MainMasterPage">
    <xsl:with-param name="Content1">
      <h1>Title</h1>
      <p>More Content</p>
      <xsl:call-template name="SomeOtherTemplate"/>
     </xsl:with-param>
   </xsl-call-template>
</xsl:template>

What happens is that the nested xml is basically stripped and all that is inserted is “TitleMore Content”

  • 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-15T20:57:03+00:00Added an answer on May 15, 2026 at 8:57 pm

    The problem with the provided code is here:

    <xsl:value-of select="$Content1"/>
    

    This will output either the concatenation of all text-nodes descendents of the top node of $Content1 (if it contains a document) or the string value of its first element or text child (if it is an XML fragment).

    You need to use

    <xsl:copy-of select='$pContent1'>

    instead of

    <xsl:value-of select='$pContent1'>.

    This correctly copies all children nodes of $pContent1

    Below is a corrected transformation:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:template match="/">
      <xsl:call-template name="MainMasterPage">
        <xsl:with-param name="pContent1">
          <h1>Title</h1>
          <p>More Content</p>
          <xsl:call-template name="SomeOtherTemplate"/>
         </xsl:with-param>
       </xsl:call-template>
    </xsl:template>
    
    <xsl:template name="MainMasterPage">
      <xsl:param name="pContent1"/>
      <html>
        <!-- bunch of stuff here -->
        <xsl:copy-of select="$pContent1"/>
      </html>
    </xsl:template>
    
     <xsl:template name="SomeOtherTemplate">
       <h2>Hello, World!</h2>
     </xsl:template>
    </xsl:stylesheet>
    

    When this transformation is applied on any XML document (not used), the wanted, correct result is produced:

    <html>
       <h1>Title</h1>
       <p>More Content</p>
       <h2>Hello, World!</h2>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically what I'm trying to do is recreate this site with pure HTML, CSS
I have the following XML that I am trying to recreate with the lxml.objectify
I'm trying to create a composite ASP.NET control that let's you build an editable
Basically, I am trying to recreate PHP date's year functionality. Using the number of
I was basically trying to follow http://www.building58.com/examples/tabSlideOut.html tutorial and I'm having that error, what
I'm basically trying to do a dropdown jquery plugin. HTML <script type='text/javascript' src='script.js'></script> <div
I'm basically trying to create a generic object in javascript that I can use
I'm basically trying to setup my own private pastebin where I can save html
I'm basically trying to achieve this effect. It can be done with pretty much
I am new to asp .net mvc3 I am trying to store additional user

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.