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

Re: printing text output excluding some nodes

Subject: Re: printing text output excluding some nodes
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Tue, 12 Apr 2005 08:29:55 -0700 (PDT)
xsl output text
Sorry, your problem description is not quite clear to
me! But making a best guess, I could think of this
XSL.. 

<?xml version="1.0"?> 
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
 
<xsl:output method="text" /> 
 
<xsl:template match="/">
  <xsl:for-each select="//Data">
    <xsl:if test="not(preceding-sibling::Control[@id =
'a' or @id = 'x'])">
      <xsl:value-of select="." /><xsl:text>
</xsl:text>
    </xsl:if>
  </xsl:for-each>
</xsl:template>

</xsl:stylesheet>

Regards,
Mukul

--- swetha d <swethaxml@xxxxxxxxx> wrote:
> 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/
> 
> 


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

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.