[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

IDL "inheritence"

Subject: IDL "inheritence"
From: Ram <sram_30@xxxxxxxxx>
Date: Fri, 14 Nov 2003 01:52:05 -0800 (PST)
snake identifier
Hi, 
 I missed few things, i.e. the <xsl:template match=""> item in my previous
email. 
 Actually, I'm generating TTCN-3 output from IDL(Interface Definition
Language) input. For that I need to handle inheritence in IDL. For an IDL
input like this:

      module Snake {
	interface Adder {
	   string accumulate(inout long a);
	};
	interface a:Adder {
	   void success(in string cool);
	};
	interface b:a {
	   long reset(in string c);
	};
     };

  The output should look like:
       
     module Snake{
	group AdderInterface {			
		signature Adder_accumulate (inout long a)
                                    return iso8859string;	
        }
	group aInterface {					
			
		signature a_success (in iso8859string cool);		

		signature a_accumulate (
		inout long a) return iso8859string;
	}
	group bInterface {						
			
		signature b_reset (in iso8859string c)			
				return long;		

		signature b_accumulate (inout long a)		
				return iso8859string;
           
                signature b_success (in iso8859string cool);
	}
     }

     
  I've parsed the IDL file with ANTLR tool and xml serialized it. The
xml file after the conceptual mapping with which I need to generate the
TTCN-3 text output is shown below.

<?xml version="1.0" encoding="UTF-8"?>
<formatted-xml>
 <module>module<identifier>Snake</identifier><identifier>{</identifier>
  <group>group<identifier>Adder</identifier><identifier>{</identifier>
    <returntype>
      <iso8859string>iso8859string				   
         <operation><identifier>accumulate</identifier>         
                             <identifier>(</identifier>			   
            <inout>inout<returntype><long>long</long></returntype>
					<identifier>a</identifier>
	    </inout><identifier>)</identifier>
	 </operation>
      </iso8859string>
    </returntype>
		<identifier>, </identifier>
		<identifier>}</identifier>
   </group>
		   
   <group>group<identifier>a</identifier><identifier>Adder</identifier>
                                          <identifier>{</identifier>
     <returntype>
	<void>void
          <operation><identifier>success</identifier>
                           <identifier>(</identifier>					    
            
<in>in<returntype><iso8859string>iso8859string</iso8859string>
                   </returntype><identifier>cool</identifier>
	     </in><identifier>)</identifier>
	  </operation>
	</void>
     </returntype>
		<identifier>, </identifier>
		<identifier>}</identifier>
   </group>
		 
 <group>group<identifier>b</identifier><identifier>a</identifier> 
                                       <identifier>{</identifier>
   <returntype>
       <long>long 				  
         <operation><identifier>reset</identifier>
                                      <identifier>(</identifier>
	    <in>in<returntype><iso8859string>iso8859string</iso8859string>
                  </returntype><identifier>c</identifier>
	    </in><identifier>)</identifier>
	 </operation>
       </long>
    </returntype>
		<identifier>, </identifier>
		<identifier>}</identifier>
   </group>
   <identifier>}</identifier>
 </module>
</formatted-xml>

   I could handle generate all stuffs except the inheritence.
The XSL I wrote to generate the inheritence output was:


<xsl:template match="group">
	<xsl:variable name="interfaceID" select="identifier"/>
	group<xsl:text> </xsl:text><xsl:value-of   
                                       select="$interfaceID"/>Interface {
	<xsl:call-template name="generation"/>	
	<xsl:apply-templates select="generation"/>
	<xsl:apply-templates select="group"/>
	}
</xsl:template>

<xsl:template name="generation" match="operation">
  <xsl:variable name="interfaceID" select="identifier"/>
  <xsl:choose>
   <xsl:when test="identifier[2]!='{' and   
                   identifier[2]=preceding::group/identifier">
   signature <xsl:value-of select="$interfaceID"/>_<xsl:value-of  
              select="preceding::returntype/*/operation/identifier"/> (
     <xsl:choose>
	<xsl:when test ="preceding::returntype/*/operation/in">
	  <xsl:value-of select="preceding::returntype/*/operation/in"/>
	</xsl:when>
	<xsl:when test ="preceding::returntype/*/operation/inout">
	  <xsl:value-of select="preceding::returntype/*/operation/inout"/>
	</xsl:when>
	<xsl:when test ="preceding::returntype/*/operation/out">
	  <xsl:value-of select="preceding::returntype/*/operation/out"/>
	</xsl:when>
    </xsl:choose>)
    <xsl:choose>
	<xsl:when test="preceding::returntype/*/text()">
	   return <xsl:value-of select="preceding::returntype/*/text()"/>
	</xsl:when>
    </xsl:choose>
    <xsl:choose>
	<xsl:when test="preceding::returntype/*/operation/exception">
	   exception (<xsl:value-of select=           
           
"preceding::returntype/*/*/exception/identifier[2]"/>Exception)
	</xsl:when>
    </xsl:choose><xsl:text>;</xsl:text>
   </xsl:when>
  </xsl:choose>
</xsl:template>

   And the output I get is:

  module Snake{
     group AdderInterface {			
	signature Adder_accumulate (inout long a)
				return iso8859string;		

     }
     group aInterface {	
	signature a_success (in iso8859string cool);	
	signature a_accumulate (inout long a)		
				return iso8859string ;
     }
     group bInterface {	
	signature b_reset (in iso8859string c)			
				return long;
	// here i've the real problem. It mixes the preceding group
        // operations. it should be 
        //signature b_accumulate (inout long a)		
	//			return iso8859string ;
        // And the third signature is missing
          
	signature b_success (in iso8859string cool)		
				return iso8859string ;
	}
}

  Someone please help me.
Thanks and regards,
Ram

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.