Re: [xsl] Generating a list of items NOT present in source XML

Subject: Re: [xsl] Generating a list of items NOT present in source XML
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 17 May 2002 23:55:06 +0100
Hi Greg,

>>   <xsl:with-param name="count" select="count + 1" />
>
>      [  Just for those following this thread (and later
>       in the archives), the above line (and others like
>       it) should probably read as
>       <xsl:with-param name="count" select="$count + 1" />
>       Note the dollar-sign before 'count'.  Without it,
>       you will have an infinite recursion. ]

Good catch! Whoops.

> The above works for the simple XML document given in the previous
> post because the string() of the obj node is the same as the
> string() of the only contained obj/childnode node. What is the best
> way (or is there a way) to allow $index to be converted from a
> string to the XPath that the string represents?

You can't do dynamic evaluation of XPaths within XSLT. If you just
want to go down one level, the best way is to have $index hold a
string just containing the name of the child node that you want to
select. Then you can do:

 <xsl:when test="$start-number > $nodes[1]/*[local-name() = $index]">
   ...
 </xsl:when>

and so on. (I'm not really sure why you want to do it like this -- why
not pass in the childnodes directly?)

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread