• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 539
  • Last Modified:

Cascading XSLT's


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.


1 Solution
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!
pandey5Author Commented:
Thanks a lot for your help. I will try to analyse this and test this. I will let you know when i finish.

<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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now