RE: with-param looping problem...
> My stylesheet looks like this: Without trying to understand or solve your problem in detail, there are some real oddities in your code. > <xsl:key name="task" match="Task" use="UID"/> > <xsl:for-each select="//Task"> Here you're selecting all the tasks in the document. > <xsl:for-each select="key('task',UID)"> Here you're selecting each task whose UID is the same as that of the current task. But since the UIDs of the tasks seem to be unique, it seems this will always select the current task, in other words it's the same as <xsl:for-each select=".">, which is a no-op. > <tr> > <td> > <xsl:value-of select="key > ('task',UID)/Name"/> Now you're selecting the current task yet again, and outputting its Name. I don't know what you're trying to do here, but it really looks as if you've misunderstood what key() does. In each of these expressions, key('task',UID)/UID can simply be replaced by UID. > <xsl:template name="get-uid"> > <xsl:param name="rid"/> > <xsl:call-template name="get-name"> > <xsl:with-param name="rid"/> > </xsl:call-template> > </xsl:template> This template doesn't appear to add value. What's the point of a named template that just calls another named template with the same parameter? Calling get-uid has exactly the same effect as calling get-name. Except - I just noticed this - it isn't passing on the value of its parameter. That would be <xsl:with-param name="rid" select="$rid"/> > > <xsl:template name="get-name"> > <xsl:param name="rid"/> > <xsl:value-of select="key('worker',UID)/Name"/> > </xsl:template> This named template is fishy because it doesn't use the value of its parameter $rid. Perhaps you meant <xsl:value-of select="key('worker',$rid/UID)/Name"/>. Except that you're calling the template without supplying a value for the parameter, so it makes some kind of perverse sense to not use the value that you aren't supplying. But I'm left totally confused as to what you're actually trying to achieve. The key named "worker" only makes sense if you supply it a UID that identifies a resource. But you're supplying UID, which is the UID child of the context node, which is still a <Task>, because you haven't done anything that changes the context. Michael Kay http://www.saxonica.com/
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format