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

Re: accessing parent element in if clause

Subject: Re: accessing parent element in if clause
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Thu, 20 Jan 2005 12:06:38 -0000
if clause
If you just wanted to match the node which has the definition as a parent,
you could do with
<xsl:template match="node[parent::definition]">
I assumed that 'node' is a  physical node in your XML ...or did you mean
node() to say any node which has a parent called definition??
HTH
vasu


----- Original Message ----- 
From: "Rahil Qamar Yahoo" <qamar_rahil@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, January 20, 2005 12:01 PM
Subject:  accessing parent element in if clause


> Hi
>
> Im sure its a fairly basic question for most but Im just starting out on
> XSLT and cant find any resources to solve my problem.
>
> I want to perform an operation based on an 'if' clause as shown below
>
> -----------------------------------
> <xsl:template match="/">
>     <PrimeConcept><xsl:apply-templates
select="/archetype/definition/node"/>
>     </PrimeConcept>
> </xsl:template>
>
> <xsl:template match="node">
>     <xsl:if test="parent::node()=definition">
>         <xsl:attribute name="id"><xsl:value-of
> select="@id"/></xsl:attribute>
>         <xsl:attribute name="type"><xsl:value-of
> select="@rm_class"/></xsl:attribute>
>     </xsl:if>
> </xsl:template>
> ----------------------------------
>
> Theres a problem with the <xsl:if> statement where Im trying to
> determine whether the <node> element is the child of the <definition>
> element. I think theres a problem in the way Im trying to access the
> parent node but cant figure out the right way.
>
> Could someone please help.
>
> Thanks
> Rahil

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.