473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to include different XSLT files on the fly based on some criteria?

Hi Friends

I have to call 1 of the 2 child XSLT files from the Main XSLT file
based on some criteria. I want one child XSLT file will be executed by
version 1 of XSLT processor and the other by version 2 of XSLT
processor based on some condition.

Q) How and where shall I write logic or import desirable XSLT on the
Fly ?
Q) When we call AAA.XSLT then it will be processed by XSLT Processor 1
and when we call BBB.XSLT,it will be called by XSLT processor 2. (This
is what I want to happen). Is this statement correct? Is it possible?

---Main.XSLT-----
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- This functionality is not supported. -->
<xsl:choose>
<xsl:when test = "X = AAA">
<xsl:include href=".\AAA.xslt"/>
</xsl:when>
<xsl:when test = "X = BBB">
<xsl:include href=".\BBB.xslt"/>
</xsl:when>
</xsl:choose>
</xsl:stylesheet>

---AAA.XSLT----------
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<!----some code here for version 1 of xslt---->
</xsl:template>
</xsl:stylesheet>
---BBB.XSLT-----------
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<!------some code here for version 2 of xslt---->
</xsl:template>
</xsl:stylesheet>
Thanks
Mohit
mo*****@hotmail.com
Jul 20 '05 #1
1 3562


Mohit wrote:
I have to call 1 of the 2 child XSLT files from the Main XSLT file
based on some criteria. I want one child XSLT file will be executed by
version 1 of XSLT processor and the other by version 2 of XSLT
processor based on some condition.

Q) How and where shall I write logic or import desirable XSLT on the
Fly ?
Q) When we call AAA.XSLT then it will be processed by XSLT Processor 1
and when we call BBB.XSLT,it will be called by XSLT processor 2. (This
is what I want to happen). Is this statement correct? Is it possible?

---Main.XSLT-----
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- This functionality is not supported. -->
<xsl:choose>
<xsl:when test = "X = AAA">
<xsl:include href=".\AAA.xslt"/>
</xsl:when>
<xsl:when test = "X = BBB">
<xsl:include href=".\BBB.xslt"/>
</xsl:when>
</xsl:choose>
</xsl:stylesheet>

---AAA.XSLT----------
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<!----some code here for version 1 of xslt---->
</xsl:template>
</xsl:stylesheet>
---BBB.XSLT-----------
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<!------some code here for version 2 of xslt---->
</xsl:template>
</xsl:stylesheet>


As for testing features before you use them you could use the XSLT
functions element-availabe and function-available and xsl:fallback.
However I don't see a way to conditionally include a stylesheet.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Tom Cat | last post by:
Is there anything wrong with using a lot of include files? On one part of my website, I have a form. The page it posts data to, includes a different file based on some of the values. The...
3
by: VBH | last post by:
This is probably a silly question but... I have an XML file which processes quite happily with XSL when opened on its own. However, I just want to include it in an ASP file. But when I do an...
2
by: Econ | last post by:
XML as part of HTML in different browsers In one folder are few files - XML - file with data - HTML - file with static text - XSL - file for transformation XML data into HTML - CSS -...
1
by: Piet L. | last post by:
hey, I have a huge database (MySQL), and now I want to display that information on my website. I want to organize it in such way that the user can say what he wants to see. For example, only...
11
by: wenmang | last post by:
Hi, all: What will happen if header files with the exact same names but with different contents and declared/defined without include guard reside in the include path for the compiler? Are these...
3
by: Davide Bedin | last post by:
I have a "library" schema with the simple and complex types I commonly use in other schemas and then several other schemas, maybe created by other developers, that import/include the library...
2
by: Keith Chadwick | last post by:
I have been running some tests with regards to xsl:include and xsl:import with the same results on both and I am wondering if someone can explain this behavior to me! First off the xslt file is...
6
by: Gideon de Swardt | last post by:
I am trying to do a server side transformation using an xsl:include in my xslt stylesheet. The include stylesheet is stored /Library/abo.Library.xslt and is included in multiple xslts, one example...
3
by: Simon Brooke | last post by:
I'm trying to do internationalisation by using xsl:include to include a different file depending on the locale setting, and I'm completely failing. I've tried several different approaches: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.