Xsl import

Posted on 2014-08-11
Last Modified: 2014-09-07
I am trying to pick appropriate xsl based on certain condition...following is what I was trying to achieve that and was running into an error. The following might not be a way to do this but I hope I'm able to convey the idea here.


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="" xmlns:saxon="" xmlns:fos="" xmlns:fo="">
            <xsl:when test="CONDITION">
                  <xsl:import href = "first.xsl"/>
                  <xsl:import href = "second.xsl"/>
Question by:jdharsha
    1 Comment
    LVL 35

    Accepted Solution

    No you can't do that. If you check out the reference for xsl:import...   you will see a statement that says
    The xsl:import element is only allowed as a top-level element. The xsl:import element children must precede all other element children of an xsl:stylesheet element

    Can you give a bit more complete example of what you are trying to achieve? ie. what functionality is in those two .xsl files that you are trying to choose between. This may allow us to better provide you with a solution to do what you want.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API ( has made its way into the popular lexicon of the English language.  A few years ago, …
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    Video by: Michael
    Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now