[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Using variables to get the complement of a node set


Subject: Re: [xsl] Using variables to get the complement of a node set
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 10 Feb 2012 11:42:45 +0000

On 10/02/2012 11:31, ihe onwuka wrote:
Suppose the children of the context node are elements named A to Z.

Then I declare a variable

<xsl:variable name="alpha" select="A|B|C|D"/>

Now i want to match on the complement of alpha.

Can I say

it would have been quicker just to try, but...

<xsl:template match="* except $alpha"/>
no that would be a legal xpath but not a pattern

or
<xsl:template match="*[not $alpha]"/>

no, that's a syntax error so wouldn't run at all


easiest is

<xsl:template match="*"> the complement

<xsl:template match="A|B|C|D" priority="2"> this one

David


________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________



Current Thread
Keywords