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

Re: selecting the following-sibling in recursive sear

Subject: Re: selecting the following-sibling in recursive search...
From: Arulraj <p_arulraj@xxxxxxxxx>
Date: Fri, 18 Nov 2005 01:12:51 -0800 (PST)
following sibling recursive
Hello Mukul,

Thanks for coding..

Already i am using some recursive technique in my
code.. when i use this.. my parser gets hanging..It
give stack overflow message.

For the sequential and simple code, your code works
fine.

Is there any other way to access this? like I can
generate-id of  next <list> from the current template.
So, passing this to another template selecting the
following-sibling current element and
preceding-sibling of that <list> id.

I need help to write that criteria..
Regards,
Raj

--- Mukul Gandhi <gandhi.mukul@xxxxxxxxx> wrote:

> Hi Raj,
>   Please try this approach. It uses a recursive
> named template.
> 
> <?xml version="1.0"?>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> 
> <xsl:output method="xml" indent="yes" />
> 
> <xsl:template match="/main">
>    <output>
>      <xsl:call-template
> name="select-sibling-elements">
>        <xsl:with-param name="node" select="list[1]"
> />
>      </xsl:call-template>
>    </output>
> </xsl:template>
> 
> <xsl:template name="select-sibling-elements">
>    <xsl:param name="node" />
> 
>    <xsl:if
> test="not(name($node/following-sibling::*[1]) =
> 'list')">
>      <xsl:copy-of
> select="$node/following-sibling::*[1]" />
>      <xsl:call-template
> name="select-sibling-elements">
>        <xsl:with-param name="node"
> select="$node/following-sibling::*[1]" />
>      </xsl:call-template>
>    </xsl:if>
> 
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> Regards,
> Mukul
> 
> On 11/17/05, Arulraj <p_arulraj@xxxxxxxxx> wrote:
> > Hi,
> >
> > I have the following XML fragment..
> > <main>
> > <list>
> >  <item/>
> > </list>
> > <table/>
> > <p name="head1"/>
> > <p name="head2"/>
> > <list>
> >  <item/>
> > </list>
> > <p name="head3"/>
> > <list/>
> > </main>
> >
> > In my XSL, i want to search the following-sibling
> of
> > <list> item.
> > so, from the first <list> i am selecting the
> > following-siblings
> > it should select only sibling before the next
> <list>.
> > like <table/>,  <p name="head1/> and <p
> > name="head2"/>.
> >
> > How to do that search criteria in the XSL?
> >
> > Thanks in advance
> >
> > Raj
> 
> 



		
__________________________________ 
Start your day with Yahoo! - Make it your home page! 
http://www.yahoo.com/r/hs

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.