RE: [xsl] Hierarchy problem

Subject: RE: [xsl] Hierarchy problem
From: "McNally, David" <David.McNally@xxxxxxxxxx>
Date: Mon, 22 Jul 2002 09:58:23 -0400
Yes - this was me being an idiot - but I think it's still a reasonable
approach - point to the parent using "..", and then see if it is the same as
the node you want to test - which should, of course, be done using
generate-id rather than "=".  So a corrected version is:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="text"/>
	
<xsl:template match="/">
<xsl:variable name="point1" select="//*[@id='noteId']"/>
<xsl:variable name="point2" select="//level2[@id='l2']"/>
<xsl:choose>
	<xsl:when test="generateid($point1/..) = generate-id($point2)">
		<xsl:text>Yes</xsl:text>
	</xsl:when>
	<xsl:otherwise>
		<xsl:text>No</xsl:text>
	</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

But I've been wrong before, and perhaps there's some other error...so handle
with care.

David.
--
David McNally            Moody's Investors Service
Software Engineer        99 Church St, NY NY 10007 
David.McNally@xxxxxxxxxx            (212) 553-7475 


> -----Original Message-----
> From: David Carlisle [mailto:davidc@xxxxxxxxx]
> Sent: Monday, July 22, 2002 7:56 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Hierarchy problem
> 
> 
> 
> 
> 
> > <xsl:when test="$x/.. = $y">
> 
> If you use that test instead of count() or generate-id() based test
> then you are not testing if x and y are related you are testing if any
> relatives of x have the same character data as the character 
> data of y.
> 
> = in XPath tests the string-value of its arguments.
> 
> So this doesn't meet your initial requirement statement at all.
> 
> David
> 
> _____________________________________________________________________
> This message has been checked for all known viruses by Star Internet
> delivered through the MessageLabs Virus Scanning Service. For further
> information visit http://www.star.net.uk/stats.asp or 
> alternatively call
> Star Internet for details on the Virus Scanning Service.
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


---------------------------------------

The information contained in this e-mail message, and any attachment thereto, is confidential and may not be disclosed without our express permission.  If you are not the intended recipient or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution or copying of this message, or any attachment thereto, in whole or in part, is strictly prohibited.  If you have received this message in error, please immediately notify us by telephone, fax or e-mail and delete the message and all of its attachments.  Thank you.

Every effort is made to keep our network free from viruses.  You should, however, review this e-mail message, as well as any attachment thereto, for viruses.  We take no responsibility and have no liability for any computer virus which may be transferred via this e-mail message.


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


Current Thread