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

RE: Hierarchy problem

Subject: RE: Hierarchy problem
From: "McNally, David" <David.McNally@xxxxxxxxxx>
Date: Fri, 19 Jul 2002 15:14:00 -0400
hierarchy problem
Does this do what you want - it checks if the node in $point2 is the parent
of the node in $point1 (I think):

<?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="$point1/.. = $point2">
		<xsl:text>Yes</xsl:text>
	</xsl:when>
	<xsl:otherwise>
		<xsl:text>No</xsl:text>
	</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

I don't think this would be complicated by using document() in the variable
definitions (but could be wrong).

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

> -----Original Message-----
> From: DPawson@xxxxxxxxxxx [mailto:DPawson@xxxxxxxxxxx]
> Sent: Friday, July 19, 2002 10:43 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Hierarchy problem
> 
> 
> With a structure such as
> 
> 
> <bodymatter>
>   <level1 id='l1'>
>    <h1>Level1</h1>
>    <level2 id='l2'>
>     <h2>Level2</h2>  <!-- bad navPoint 1 -->
>     <level3 id='l3'> <!-- good navPoint 2 -->
>      <h3>level3</h3>
>      <note id="noteId">  <!-- navLabel target -->
>       <p>Note content</p>
>      </note>
>     </level3>
>    </level2>
>   </level1>
> 
> ....
> 
> I need to check that the node with id=noteId
> is (or is not) a direct descendant of another node (e.g. 
> level2[id='l2'])
> or if there are intervening levelX elements.
> 
[snip]


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

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

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.