Altova Mailing List Archives

Re: Selcting filtered node set based on variable

From: "Joris Gillis" <roac@-------.-->
Date: 12/1/2004 4:11:00 PM
> Question for the masses...
Panem et circenses
> Lets say I have variable with the following contents
> "aaaa bbbb ccccc dddd".  The format is not specific and the space
> delimiter could be changed to any other.
> How would i count and/or select the nodes where a child nodes value is
> not contained in this list.  Or the reverse scenario would be sufficent
> whereas I count the nodes whose child nodes value is contained.
> A contrived example of my situation follows...thanks for the help.
> <root>
> <limbs>
> <branch>
> <name>a</name>
> <flower>big</flower>
> </branch>
> <branch>
> <name>b</name>
> <flower>big</flower>
> </branch>
> <branch>
> <name>c</name>
> <flower>large</flower>
> </branch>
> <branch>
> <name>d</name>
> <flower>giant</flower>
> </branch>
> </limbs>
> </root>


In this situation, the following stylesheet might work:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
<xsl:output method="html" indent="yes" omit-xml-declaration="yes"/>
<xsl:variable name="Exclude">
big large

<xsl:template match="/">
	<xsl:variable name="DomainCount">
		<xsl:value-of select="count(//branch[not(contains($Exclude,flower))])"/>


Joris Gillis (
Ceterum censeo XML omnibus esse utendum


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 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.