|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: : Sibling in the Pattern(match)
Thanks, That is the exact thing I'm looking for. It works as expected. Dongling > > Within a match pattern one would write: > > Member[@name = > 'acc1']/Member[following-sibling::Member[@name='acc11']] > > > So, this transformation: > > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <xsl:output omit-xml-declaration="yes"/> > > <xsl:template match="@* | node()"> > <xsl:copy> > <xsl:apply-templates select="@* | node()"/> > </xsl:copy> > </xsl:template> > > <xsl:template match= > "Member[@name = 'acc1'] > / > > Member[following-sibling::Member[@name='acc11']]"/> > > </xsl:stylesheet> > > when applied on this source.xml: > > <D> > <Member comment="" name="acc1"> > <Calc>+</Calc> > <Member comment="" name="acc101"> > <Calc>+</Calc> > </Member> > <Member comment="" name="acc1021"> > <Calc>+</Calc> > </Member> > <Member comment="" name="acc11"> > <Calc>+</Calc> > <Member name="account3_1"/> > </Member> > <Member comment="" name="acc12"> > <Calc>+</Calc> > <Member name="acc121"/> > </Member> > </Member> > <Member comment="" name="acc2"> > <Calc>+</Calc> > </Member> > <Member comment="" name="acc3"> > <Calc>+</Calc> > <Member comment="" name="acc31"> > <Calc>+</Calc> > </Member> > <Member comment="" name="acc11"> > <Calc>+</Calc> > </Member> > </Member> > </D> > > produces the wanted result, in which all preceding > siblings of the "Member" > with name="acc11" (which is a child of the Member > with name="acc1") are > removed : > > > <D> > <Member comment="" name="acc1"> > <Calc>+</Calc> > > > <Member comment="" name="acc11"> > <Calc>+</Calc> > <Member name="account3_1"/> > </Member> > <Member comment="" name="acc12"> > <Calc>+</Calc> > <Member name="acc121"/> > </Member> > </Member> > <Member comment="" name="acc2"> > <Calc>+</Calc> > </Member> > <Member comment="" name="acc3"> > <Calc>+</Calc> > <Member comment="" name="acc31"> > <Calc>+</Calc> > </Member> > <Member comment="" name="acc11"> > <Calc>+</Calc> > </Member> > </Member> > </D> > > > ===== > Cheers, > > Dimitre Novatchev. > http://fxsl.sourceforge.net/ -- the home of FXSL > > > > > > > XSL-List info and archive: > http://www.mulberrytech.com/xsl/xsl-list > __________________________________ 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








