[xsl] RE: MSXML ancestor-or-self

Subject: [xsl] RE: MSXML ancestor-or-self
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 7 Mar 2001 12:21:53 -0800 (PST)
Hi Richard,

Use:

//P[parent::C  
or count(.. | //C/ancestor::node()) = count(//C/ancestor::node() ) 
and not(@name=../descendant::node()/P/@name ) 
and count(. | //C/following::P) != count(//C/following::P )]


Hope this helps.


Cheers,

Dimitre Novatchev.


Richard Mitchell wrote:

Ok my example is a bit poor sorry for that but really my context is
C with a file like...

<A>
 	<P name="hello" value="blue"/>
	<P name="aval" value="uppest"/>
	<B>
		<P name="bval" value="upper"/>
		<P name="goodbye" value="red"/>
		<P name="hello" value="green"/>
		<C>
			<P name="goodbye" value="yellow"/>
		</C>
		<P name="goodbye" value="orange"/>
	</B>
</A>

Expecting output like...
;goodbye=yellow;hello=green;bval=upper;hello=uppest

I've just experimented a little with the | operator but can't get
anything sensible out of it
> >-----Original Message-----
> >From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Richard
> >Mitchell
> >Sent: 07 March 2001 15:12
> >To: 'XSL'
> >Subject: [xsl] MSXML ancestor-or-self
> >
> >
> >Well it seems I've hit a small snag what I want
> >is to get a list of variables in a scope so the
> >closest is taken and passed on. The XML looks
> >something like.
> >
> ><A>
> ><P name="hello" value="blue"/>
> >	<B>
> >	<P name="goodbye" value="red"/>
> >	<P name="hello" value="green"/>
> >	<C/>
> >	</B>
> ></A>
> >
> >And my current context is C. With my output looking something like
> >
> >;hello=green;goodbye=red
> >
> >So far I've got
> >	<xsl:for-each select="ancestor-or-self::*/p[ what on 
> earth can I put
> >here ]">
> >		;_<xsl:value-of select="@name"/>=<xsl:value-of
> >select="@value"/>
> >	</xsl:for-each>
> >But I've got stuck in the way that MSXML3 seems to be serving up
> >the axis in
> >document order not reverse document order like it says on 
> P717 or Michael
> >Kays
> >excellent book.
> >
> >Any and all help would be appreciated.


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

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


Current Thread