Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Selcting filtered node set based on variable [Thread Next] Re: Selcting filtered node set based on variableTo: NULL 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> Hi, In this situation, the following stylesheet might work: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes" omit-xml-declaration="yes"/> <xsl:variable name="Exclude"> big large </xsl:variable> <xsl:template match="/"> <xsl:variable name="DomainCount"> <xsl:value-of select="count(//branch[not(contains($Exclude,flower))])"/> </xsl:variable> </xsl:template> </xsl:stylesheet> regards, -- Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041) Ceterum censeo XML omnibus esse utendum | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
