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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:25:17+00:00 2026-05-24T05:25:17+00:00

I use XSLT as template engine in my PHP framework. Some XSLT files are

  • 0

I use XSLT as template engine in my PHP framework. Some XSLT files are in different folders,so if I want to include/import xslt template not from main directory I have to type a lot:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">   
    <xsl:import href="dir1/dir2/dir3/dir4/layout.xsl"/> 

    <xsl:template name="content">
        <html>
            <head>
                <title>action.xsl</title>
            </head>
            <body>
                test
            </body>
        </html>
    </xsl:template>

</xsl:stylesheet>

Is there any easy way to reduce this dir1/dir2/dir3/dir4/layout.xsl ? dir1/dir2/dir3/dir4/ are static (never changes).

Separate template with all includes does not fit, because each template requires different files, and after some time it is difficult to understand what’s included and where.

I thought perhaps ​​it is possible to do something with xml:base <xsl:import href="layout.xsl" xml:base="dir1/dir2/dir3/dir4/" />, but do not know how.

Thanks

  • 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-24T05:25:18+00:00Added an answer on May 24, 2026 at 5:25 am
    <xsl:import href="layout.xsl" xml:base="dir1/dir2/dir3/dir4/" />
    

    is possible in XSLT 2.0 but not in 1.0.

    Did you try it in XSLT 2.0 (e.g. in Saxon), and if so, what was the result?

    You cannot put import statements into templates; each import statement must be at the top level below the stylesheet element.

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

Sidebar

Related Questions

I use XSLT as template engine in my PHP framework. HTML forms are in
I'm trying to use XSLT to generate some XHMTL with inline PHP. I've run
I am working on a webpage and I use XSLT as template engine. I
I have an XML document with un-namespaced elements, and I want to use XSLT
I want to create conditional comments in XSLT. But when I use this: <!--
I am currently trying to use XSLT to be my print report template in
I am trying to use XSLT variables and not having much success, hopefully I'm
I could use some help creating an XSL template that will take a string
I use this code to transform XML to HTML using XSLT template: string uri
Apart from rewriting a lot of XSLT code (which I'm not going to do),

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.