This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Node selection based on parent attribute


must be <xsl:if test="..."/>

Regards,

Joerg

katharine wykes wrote:

Still trying to get a better understanding of xslt. Using the code you specified below brings up a parser error:
Attribute 'select' is invalid on 'xsl:if'.

Any clues as to the cause of this?
Cheers,


From: Wendell Piez <wapiez@mulberrytech.com>
Reply-To: xsl-list@lists.mulberrytech.com
To: xsl-list@lists.mulberrytech.com
Subject: Re: [xsl] Node selection based on parent attribute
Date: Fri, 30 Aug 2002 12:24:31 -0400

Katharine,

Another approach (besides the ones using for-each) is just to use the built-in descent of the tree, as in something like:

<xsl:template match="menu">
<xsl:if select="ancestor::menu[@id=$id']">
<xsl:value-of select="@id"/>
<!-- copies out this menu's @id if it has an ancestor
menu with @id = $id -->
</xsl:if>
<xsl:apply-templates/>
<!-- continues the tree traversal in case there are any below -->
</xsl:template>

Make sure the parameter is set to the *value* of the id ('1', '6', whatever) whose descendants you want.

Cheers,
Wendell

--

System Development
VIRBUS AG
Fon  +49(0)341-979-7419
Fax  +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]