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

Re: preceding sibling

Subject: Re: preceding sibling
From: Mukul Gandhi <mukulgandhi2003@xxxxxxxxxxx>
Date: Sun, 18 Apr 2004 11:58:22 +0100 (BST)
lena kaarle
Hi Kaarle,
  Can you please explain the XML structure? How does a
<notice> tag relate to the previous and next <notice>
tag? Is there some grouping?

In one <notice> tag, you have'nt mentioned tag="NAME"
-

<notice>
  <name>
    <givenname>Lena</givenname>
    <surname>Karamazina</surname>
  </name>
</notice>

Regards,
Mukul

 --- Kaarle Kaila <kaarle.kaila@xxxxxx> wrote: > My
XML file contains data like this:
> 
> <person sex="F">
> <name>
> <givenname>Lena</givenname>
> <surname>Karamazina</surname>
> </name>
> 
> <notices>
> <notice tag="NAME">
> <name>
> <givenname>Lena</givenname>
> <surname>Koski</surname>
> </name>
> </notice>
> 
> <notice tag="BIRT">
> <date>1944</date>
> <place>Tyrvdd</place>
> </notice>
> <notice>
> <name>
> <givenname>Lena</givenname>
> <surname>Karamazina</surname>
> </name>
> </notice>
> 
> <notice tag="NAME">
> <name>
> <givenname>Lena-Lisa</givenname>
> <surname>Karamazina</surname>
> </name>
> </notice>
> </notices>
> </person>
> --------------------------------
> I want to print the names after each other but if
> teh givenname is same as
> previous one then I want to print only the surname.
> 
> The lower part of this xsl section is OK to compare
> the name in the person
> but how should I compare with the givenname of the
> previous sibling in
> notice element with tag="NAME".
> 
> Any advice would be appreciated. I am having some
> difficulties in reading
> the XSLT book Expressions chapter I guess.
> 
> 
> 
> <xsl:template match="givenname">
> 
> 
> <xsl:choose>
> <xsl:when
>
test="../../../notice::preceding-sibling[@tag='NAME']=.">
> <xsl:text> </xsl:text>
> <xsl:apply-templates/>
> </xsl:when>
> 
> <xsl:when test="ancestor::person/name/givenname=.">
> </xsl:when>
> <xsl:otherwise>
> <xsl:text> </xsl:text>
> <xsl:apply-templates/>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
> 
> ------------------
> regards
> Kaarle Kaila
> --
> Kaarle Kaila
> email: kaarle dot kaila at iki dot fi
> www.iki.fi/kaila
>  

________________________________________________________________________
Yahoo! India Matrimony: Find your partner online. http://yahoo.shaadi.com/india-matrimony/

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.