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

Trimming the xsl code

Subject: Trimming the xsl code
From: Ram <sram_30@xxxxxxxxx>
Date: Tue, 25 Nov 2003 01:46:11 -0800 (PST)
xsl code
Hi,
Can anyone help me out in trimming my xsl code to get the deisred output?
The input xml is:

<output-xml>
<group>
  <identifier>a</identifier>
     group a_Interface {
       // Signature definition
       signature a_<signature>DNSQuery1(in long ant)
                                         return iso8859string;
                        </signature>
     }
</group>
<group>
  <identifier>b</identifier>
  <identifier>a</identifier>
    group b_Interface {
       // Signature definition
       signature b_<signature>DNSQuery2(inout string grass) 
                                          return long;
                         </signature>
    }
</group>
<group> 
  <identifier>c</identifier>
  <identifier>b</identifier>
    group c_Interface {
      // Signature definition
      signature c_<signature>DNSQuery3(out boolean fish)
                                       return boolean;
                        </signature>
    }
</group>
<group>
   <identifier>d</identifier>
   <identifier>c</identifier>
     group d_Interface {
        // Signature definition
       signature d_<signature>DNSQuery3(out long cricket)
                   return short;
                   </signature>
     }
</group>
</output-xml>

The xsl:

<xsl:output method="text" indent="yes"/>
<xsl:key name="GroupByIdentifier" match="group" use="identifier[1]"/>

<xsl:template match="signature">
<xsl:variable name="CurrentGroupID" select="../identifier[1]"/>
<xsl:copy-of select="."/><xsl:text>
</xsl:text>
<xsl:if test="count(../identifier[2])>0">
signature <xsl:value-of select="$CurrentGroupID"/>_<xsl:
apply-templates select="key('GroupByIdentifier',../identifier
[2])/signature"/>
</xsl:if>
</xsl:template>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>  

 gives the output:

a
group a_Interface {
  // Signature definition
  signature a_DNSQuery1(in long ant)
                   return iso8859string;
}
b
a
group b_Interface {
  // Signature definition
  signature b_DNSQuery2(inout string grass)
                  return long;
  signature b_DNSQuery1(in long ant)
                  return iso8859string;
}
c
b
group c_Interface {
  // Signature definition
  signature c_DNSQuery3(out boolean fish)
                  return boolean;
  signature c_DNSQuery2(inout string grass)
                  return long; 
  signature b_DNSQuery1(in long ant)
                  return iso8859string;
}
d
c
group d_Interface {   
   // Signature definition 
   signature d_DNSQuery3(out long cricket)
                    return short; 
   signature d_DNSQuery3(out boolean fish)
                    return boolean; 
   signature c_DNSQuery2(inout string grass)
                    return long; 
   signature b_DNSQuery1(in long ant)
                    return iso8859string;  
}

  What I need to do is, I should remove the identifiers a, ba, cb and dc
which are generated before the group "X_Interface". And, I've to get the
current group's identifier[1]_<xsl:apply-templates  
             
select="key('GroupByIdentifier',../identifier2])/signature"/> 
for all the signatures that belong to the same group. For example, in the
last group the output should be,
 
 
group d_Interface {
   // Signature definition
  signature d_DNSQuery3(out long cricket)
       return short;
  signature d_DNSQuery3(out boolean fish)
      return boolean;
  signature d_DNSQuery2(inout string grass)
     return long;
  signature d_DNSQuery1(in long ant)
    return iso8859string;
}
 
Can anyone find what is wrong with the xsl?

Thanks and regards,
Ram

__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

 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.