Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > How to include different XSLT files on the fly based on some criteria?

Reply
Thread Tools

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

 
 
Mohit
Guest
Posts: n/a
 
      04-19-2004
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"
xmlnssl="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"
xmlnssl="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"
xmlnssl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<!------some code here for version 2 of xslt---->
</xsl:template>
</xsl:stylesheet>


Thanks
Mohit
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      04-20-2004


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"
> xmlnssl="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"
> xmlnssl="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"
> xmlnssl="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/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/* #include <someyhing.h> */ => include it or do not include it?That is the question .... Andreas Bogenberger C Programming 3 02-22-2008 10:53 AM
THE FLY & THE FLY II teem DVD Video 0 12-10-2005 09:31 PM
To Fly or not to fly? Should I move from Mozilla 1.5 to T-bird andF-bird? Daniel Steinberg Firefox 7 11-06-2003 11:31 AM
To Fly or not to fly? Should I move from Mozilla 1.5 to T-bird andF-bird? Daniel Steinberg Firefox 5 11-05-2003 06:23 AM
how to Add different controls(textBox,DropDownList or some ) in the same column,based upon the value in the previous column (Say second Colum which contain dropdown with some values) ? Balaji ASP .Net Datagrid Control 0 07-07-2003 08:32 AM



Advertisments