Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Change xpath depending on whether a param has been set [Thread Next] Re: Change xpath depending on whether a param has been setTo: NULL Date: 2/7/2005 9:09:00 AM Thanks Dimitre, I implemented your solution - thanks for the info Joe "Dimitre Novatchev" <dnovatchev@y...> wrote in message news:36ibovF50m3deU1@i...... > > "Joe Gass" <joe@n...> wrote in message > news:OsVVysqCFHA.4072@T...... >> Thanks for that idea Dimitre, I worked it out another way. I moved my >> workings to a new template, then... >> >> <xsl:choose> >> <xsl:when test="$maxNodes!=''"> >> <xsl:apply-templates select="/RESULTS/REVIEWS/REVIEW[position() <= >> $maxNodes]"/> >> </xsl:when> >> <xsl:otherwise> >> <xsl:apply-templates select="/RESULTS/REVIEWS/REVIEW"/> >> </xsl:otherwise> >> </xsl:choose> >> >> I'll give your way a go too >> >> Many thanks > > Yes, > > The idea of conditionally processing one out of two node-sets is simple > and has a generic solution. The XPath expression to be used in the select > attribute of xsl:apply-templates, xsl:for-each or for whatever other > processing (e.g. as an argument to a function) is the following: > > $ns1[$condition] | $ns2[not($condition)] > > where > > $condition is the same in both predicates XPath expression. > > This is naturally generalised to a selection of one out of N node-sets > based on the outcome of N mutually exclusive events. > > > Cheers, > Dimitre Novatchev. > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
