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

RE: Testing for Parent Nodes of multiple types

Subject: RE: Testing for Parent Nodes of multiple types
From: "Ciaran Byrne" <ciaran.byrne@xxxxxxx>
Date: Wed, 14 Mar 2001 18:18:53 -0800
parent types
Thanks Mike that worked well.
Although David Carlisle now has me thinking.
At the moment I check the parent type of the context node
but as David suggested why not work the other way
and check the child node of the context node.

My opinion on this would be that each node can
have multiple children so therefore each child would 
have to checked (David's approach). 
While each child only has one parent so only one 
parent would ever need to be checked. (Current approach)

Although it is probably also the case that checking the
parent for each child (current) is the same as checking
the child for each parent (David). Confused ? I know I am ;o)

Any one any ideas on the best approach ?

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Michael Kay
Sent: Wednesday, March 14, 2001 9:02 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Testing for Parent Nodes of multiple types


One technique I used once was to write

<xsl:variable name="cat"><xsl:apply-templates select=".."
mode="cat"/></xsl:variable>

<xsl:template match="p|b|i|u" mode="cat">A</xsl:template>
<xsl:template match="*" mode="cat">B</xsl:template>

<xsl:if test="$cat='A'"> ...

Don't know whether that's appropriate here though: I had about 50 element
types in the same category.

Mike Kay
Software AG

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
> Ciaran Byrne
> Sent: 15 March 2001 00:36
> To: Xsl-List
> Subject:  Testing for Parent Nodes of multiple types
>
>
> Hi all,
> 	In my content I am testing for the parent of
> my context node. The parent can be one of several different
> elements.
>
> For example, let's say that the parent of the element 'b' can
> be 'p','b','i','u','td'.
>
> At the moment in my xsl:if I have the node test
>
> <xsl:if test="parent::p or parent::b or parent::i or parent::u or
> parent::td">
> ...
> </xsl:if>
>
>
> Is anyone aware of a more efficient way to implement this ?
>
> Thanks,
> Ciaran.
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


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



 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.