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

Re: Name of current node's parent?

Subject: Re: Name of current node's parent?
From: Mike Brown <mike@xxxxxxxx>
Date: Wed, 3 Jan 2001 23:01:40 -0700 (MST)
xsl current parent
Michael Lee wrote:
> Let's say this is a fragment of an XML document:
> 
>    <a>
>       <b></b>
>       <b><c></c></b>
>       <c></c>
>    <a>
> 
> Instead of using
> 
>    <xsl:template match="b/c">
>    </xsl:template>
> 
> I want to use something like
> 
>    <xsl:template match="c">
>       <xsl:if test="boolean-expression"></xsl:if>
>    </xsl:template>
> 
> To check and see if the parent of <c> is <b> or not.

Now you are asking for something different.

<xsl:if test="../b">

or

<xsl:if test="parent::b">

You're just identifying a node-set containing all 'b' elements
that are along the parent axis. The set will contain 0 or 1 node.
The boolean test will be true if the set has at least 1 node.

There is also the name() function which takes a node-set argument,
but in this case it wouldn't be necessary.

   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at            My XML/XSL resources: 
webb.net in Denver, Colorado, USA              http://skew.org/xml/


 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.