Cascading XSLT's

Posted on 2003-03-17
Medium Priority
Last Modified: 2013-11-18

I have a very urgent question. If i can get a reasonable answer then it will be great.
Can i have cascaded XSLT instructions, i mean i want to execute 10 XSLT instruction but the output of the 1st XSLT instruction should be the input of the second XSLT instruction. i.e. the second XSLT shouldn't work on the original source tree but on the tree created because of first XSLT instruction.

I know that i can do it step by step, but is there a cascaded XSLT concept.


Question by:pandey5
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 27

Accepted Solution

BigRat earned 2000 total points
ID: 8153174
Yes, basically you create an xsl:variable and initialize it with a tree made from its contents :-

<xsl:variable name="fred">
    <here some xsl to make fred>

and then use fred somewhere else :-

<xsl:for-each select="$fred">

and you can keep going on like this until you loose grasp of what it all means!

Author Comment

ID: 8153231
Thanks a lot for your help. I will try to analyse this and test this. I will let you know when i finish.


Expert Comment

ID: 8174093
<xsl:stylesheet version="1.0" xmlns:msxsl="urn:schemas-microsoft-com:xslt">

<xsl:include href="mode3.xsl"/>
<xsl:include href="mode4.xsl"/>

<xsl:template match="/">
     <xsl:variable name="mode1">
          <xsl:apply-templates mode="mode1"/>
     <xsl:variable name="mode2">
          <xsl:apply-templates mode="mode2" select="msxsl:node-set($mode1)"/>
     <xsl:variable name="mode3">
          <xsl:apply-templates mode="mode3" select="msxsl:node-set($mode2)"/>
     <xsl:variable name="mode4">
          <xsl:apply-templates mode="mode4" select="msxsl:node-set($mode3)"/>

     <xsl:copy-of select="$mode4"/>


<!-- mode 1 -->
<xsl:template mode="mode1" match="someTag">
          <xsl:apply-templates mode="mode1"/>

<!-- mode 2 -->
<xsl:template mode="mode2" match="Tag2">
     <xsl:apply-templates mode="mode2"/>


Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa‚Ķ
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

770 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