Re: [xsl] Re:Help needed in recursively converting the flat xml to a heirarchical XML...

Subject: Re: [xsl] Re:Help needed in recursively converting the flat xml to a heirarchical XML...
From: "Sridhar Anupindi" <sridharanupindi@xxxxxxxxxxx>
Date: Wed, 31 Mar 2004 02:35:02 +0530
Hi Wendell,

I have provided the comments to the second issue of Nested Concurrent-block nodes.

<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet exclude-result-prefixes="fo ms" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:ms="urn:ms-xsl" xmlns:fo="http://www.w3.org/1999/XSL/Format";>
<xsl:output method="xml" encoding="UTF-8" indent="yes"/> <xsl:template match="/ |node()"><xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy></xsl:template>
<xsl:template match="@*">
<xsl:copy>
</xsl:copy>
</xsl:template>


<xsl:key name="act-name" match="/processXML/process-definition/activity-state" use="@name"/>
<xsl:key name="act-name" match="/processXML/process-definition/decision" use="@name"/>
<xsl:key name="jname" match="/processXML/process-definition/join" use="@name"/>
<xsl:key name="con-name" match="/processXML/process-definition/concurrent-block" use="fork/@name"/>


<xsl:key name="forktransitions" match="/processXML/process-definition/concurrent-block/fork/transition" use="@to"/>
<xsl:template match="activity-state[(key('forktransitions',@name))]"/>
<xsl:template match="join" />



<xsl:template name = "template1" match="/processXML/process-definition/concurrent-block">
<xsl:copy>
<!-- To Copy Concurrent-Blocks -->
<!-- From here concurrent-block starts -->
<!-- Loop starts picking the first concurrent-block -->
<xsl:for-each select="fork">
<xsl:variable name="forkname" select="@name"/>
<xsl:apply-templates select="/processXML/process-definition/concurrent-block/fork[@name=$forkname]"/>
<xsl:for-each select="transition">
<xsl:variable name="transname"><xsl:value-of select="@to"/></xsl:variable>
<xsl:copy-of select="key('act-name', $transname)"/>
<xsl:for-each select="key('act-name', $transname)">
<xsl:variable name="joinname" select="transition/@to"/>
<xsl:copy-of select="key('jname', $joinname)"/>
<xsl:for-each select="key('act-name', $joinname)">
<xsl:copy-of select="key('act-name', $joinname)"/>
</xsl:for-each>
<!-- Check whether this contains reference to another concurrent-block -->
<!-- If it is present then call the template once again to process the concurrent-block subnode-->
<xsl:for-each select="key('con-name', $joinname)">
<xsl:call-template name="template1" />
<!-- This node is already populated here.. Hence it should not -->
<!-- get populated when it is encountered in the above loop -->
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>


Hope this helps you understand the problem better.

Thanks

Sridhar Anupindi

From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Re:Help needed in recursively converting the flat xml to a heirarchical XML...
Date: Tue, 30 Mar 2004 15:00:55 -0500


Sridhar,

At 02:07 PM 3/30/2004, you wrote:
I think I made a significant progress with your explanation. Thanks, But still I am stuck with some problems.

1. As you said, I tried replacing


_________________________________________________________________
Post Classifieds on MSN classifieds. http://go.msnserver.com/IN/44045.asp Buy and Sell on MSN Classifieds.


Current Thread