Altova Mailing List Archives


RE: [xsl] Testing for Parent Nodes of multiple types

From: "Michael Kay" <mhkay@------------>
To:
Date: 3/14/2001 7:01:00 AM
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: [xsl] 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

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.