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

RE: Getting a node's cousin

Subject: RE: Getting a node's cousin
From: DPawson@xxxxxxxxxxx
Date: Wed, 11 Aug 1999 16:23:38 +0100
cousin node
the parent axis takes you up one generation.
The following-sibling axis then isolates only the cousins after your parent,
or preceding-sibling cousins before your parent,
then use the child axis to get to your cousin.

Does that make sense <grin/>

../child2_of_child2/grandchild may be what you want,
or perhaps a for-each with the node-set produced from
../childn_of_childm?


The pic on page 40 of Ken Holmans notes explains it,
some trial error finds out what the axis do,
now Nic has an example(27) at his page!

HTH DaveP


>Given this XML
><data>
><parent>parent1
><child>child1
><grandchild>child1_of_child1</grandchild>
><grandchild>child2_of_child1</grandchild>
></child>
><child>child2
><grandchild>child1_of_child2</grandchild>
><grandchild>child2_of_child2</grandchild>
></child>
></parent>
>when I am processing a grandchild, how can I access the 
>immediate next set of
>grandchildren, ie my sibling's children (hence my cousin term) 
> I've tried using
>position() incremented by 1 (with a test for existence) but 
>the position() seems
>to be always using my position and not that of my parent.
>For example ../../child[position()] uses the grandchild 
>position within the
>current child.  Not exactly what I want.
>Any thoughts?
>TIA,
>Larry Mason
>Member Technical Staff
>i2 Technologies
>---------------------- Forwarded by Larry 
>Mason/Dallas/US/i2Tech on 08/11/99
>08:59 AM ---------------------------
>
>
>Miloslav Nic <nicmila@xxxxxxxx> on 08/11/99 08:33:58 AM
>
>Please respond to xsl-list@xxxxxxxxxxxxxxxx
>
>To:   xsl-list@xxxxxxxxxxxxxxxx
>cc:    (bcc: Larry Mason/Dallas/US/i2Tech)
>Subject:  Re: Replace all occurrences
>
>
>
>
>XPath draft: http://www.w3.org/TR/xpath
>
>Henrik Andersson wrote:
>>
>> Thank you very much!
>>
>> The example really helped me. Just one more question. Where 
>can I read
>> more about the "translate()"-function?
>>
>> Thanks again!
>> /Henrik
>>
>> Miloslav Nic wrote:
>> >
>> > look at example 28 of
>> > http://zvon.vscht.cz:/HTMLonly/XSLTutorial/Books/Book1/index.html
>> > for an example.(It is not general, but it should work in your case)
>> >
>> > Henrik Andersson wrote:
>> > >
>> > > Hi!
>> > >
>> > > I have some xml looking like this:
>> > >
>> > > <?xml version="1.0"?>
>> > > <citylist>
>> > >         <distance city="A">1 HOURS</distance>
>> > >         <distance city="B">2 HOURS</distance>
>> > >         <distance city="C">30 MINUTES</distance>
>> > >         <distance city="D">6 HOURS</distance>
>> > > </citylist>
>> > >
>> > > ...and some xsl looking like this:
>> > >
>> > > <xsl:stylesheet xmlns:xsl='http://www.w3.org/XSL/Transform/1.0'>
>> > > <xsl:template match="citylist">
>> > >         <xsl:for-each select="distance">
>> > >                 <xsl:value-of select="@city"/>
>> > >                 <xsl:text>=</xsl:text>
>> > >                 <xsl:value-of select="."/>
>> > >                 <xsl:text>    </xsl:text>
>> > >         </xsl:for-each>
>> > > </xsl:template>
>> > > </xsl:stylesheet>
>> > >
>> > > Together this creates this:
>> > >
>> > > A=1 HOURS    B=2 HOURS    C=30 MINUTES    D=6 HOURS
>> > >
>> > > This is the "result" I wan't besides that instead of the 
>words "HOURS"
>> > > and "MINUTES" I wan't it to say "Hour" and "Minutes", 
>with the first
>> > > letter as a capital and the rest as small letters. Is 
>this possible to
>> > > do with xsl?
>> > >
>> > > Thanks!
>> > > /Henrik
>> > >
>> > >  XSL-List info and archive:  
http://www.mulberrytech.com/xsl/xsl-list
> >
> > --
> > ***************************************************************
> > Dr. Miloslav Nic                        e-mail: nicmila@xxxxxxxx
> > Department of Organic Chemistry         TEL: +420 2 2435 5012
> > ICT Prague (VSCHT Praha)                     +420 2 2435 4118
> >                                         FAX: +420 2 2435 4288
> > ****************************************************************
> >
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

--
***************************************************************
Dr. Miloslav Nic                        e-mail: nicmila@xxxxxxxx
Department of Organic Chemistry         TEL: +420 2 2435 5012
ICT Prague (VSCHT Praha)                     +420 2 2435 4118
                            FAX: +420 2 2435 4288
****************************************************************


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.