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

Cascading XSLT's

Hi,

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.

Thanks,

Pandey
0
pandey5
Asked:
pandey5
1 Solution
 
BigRatCommented:
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>
</xsl:variable>

and then use fred somewhere else :-

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

and you can keep going on like this until you loose grasp of what it all means!
0
 
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.

0
 
xsl-lsxCommented:
<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>
     <xsl:variable name="mode2">
          <xsl:apply-templates mode="mode2" select="msxsl:node-set($mode1)"/>
     </xsl:variable>
     <xsl:variable name="mode3">
          <xsl:apply-templates mode="mode3" select="msxsl:node-set($mode2)"/>
     </xsl:variable>
     <xsl:variable name="mode4">
          <xsl:apply-templates mode="mode4" select="msxsl:node-set($mode3)"/>
     </xsl:variable>

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

</xsl:template>

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

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

</xsl:stylesheet>
0

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