[xsl] printing text output excluding some nodes

Subject: [xsl] printing text output excluding some nodes
From: swetha d <swethaxml@xxxxxxxxx>
Date: Tue, 12 Apr 2005 06:00:52 -0700 (PDT)
Hi everybody,
    I am new to xsl.So,please I need some help for 
writing my xsl style sheet. which is similar to the
following,
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="ss.xsl" type="text/xsl"?>
<Document>
  <Group>
        <Control id="x"/>
         <Control id="y"/>
         <Data>follow</Data>
  </Group>
   <Group>
    <Control id="a"/>
    <Control id="b"/>
      <Data>hai</Data>
  </Group>
  <Group>
       <Control id="c"/>
         <Group>
               <Control id="a"/>
               <Control id="d"/>
                <Data>hello</Data>
         </Group>
         <Data>good</Data>
  </Group>
<Group>
         <Control id="e"/>
           <Data>morning</Data>
  </Group> 
  </Document>
I want my output to contain all the data in xml after
the group having control id as 'x'except the data from
groups having control id'a'(data from the group having
control id 'x' should not be included)
That means from above xml,I want output as
good morning

and my  xslt is like
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
    <xsl:output method="text"  />
        
    <xsl:template match="Document">
             <xsl:for-each select="//Group">
                      <xsl:if test="Control/@id ='x'">
                           <xsl:for-each
select="following::*">
                               <xsl:if
test="Control/@id !='a'">
                                 <xsl:apply-templates
/>
                                </xsl:if>
                            </xsl:for-each>
                      </xsl:if>
            </xsl:for-each>
   
    </xsl:template>     
    
    </xsl:stylesheet>
It is giving output as follows
 hai hello good hello morning

In xsl,instead of <xsl:if test="Control/@id !='a'">,if
i write <xsl:if test="Control/@id ='a'"> then it is
printing as  
hai hello 
same as what we expect.But when i write <xsl:if
test="Control/@id !='a'"> why it is printing data 
hai& hello also?What should i do for printing only
good morning?
Thanks,
Swetha


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/

Current Thread