Re: [xsl] Easy one! variables & documents)

Subject: Re: [xsl] Easy one! variables & documents)
From: david_n_bertoni@xxxxxxxxxx
Date: Wed, 30 Apr 2003 16:05:55 -0700



> Okay, I got that.
> Now I am having trouble... I need to select from this external doc the
value
> of one of the nodes.  So, I'm within the context of another template, and
> from this template there is an attribute @Name, who's value will match
one
> of the values from the external doc.  I'm trying to get the @Text value
from
> the external doc where the @Name matches in both.  So:
>
>      <xsl:for-each select="@*">
>         <tr>
>         <td><!-- lookup text for display in xml template -->
>         <xsl:value-of select="$xmTmplt/[@name=name()]/text"/>
>         </td>
>
> ...  doesn't work : (

As I said previously, you're really not giving us enough to understand your
problem.  What does "doesn't work" mean, and what does this mysterious
document look like?

> <xsl:value-of select="$xmTmplt/[@name=name()]/text"/>

This is not a valid XPath expression, because there's no node test in the
second step.  Does the FLD element have an attribute called name?  If so,
then may be you meant this:

   "$xmTmplt[@name=name()]/text"

And what are you expecting to get back from the call to the name()
function?  Is it the attribute name in the outer xsl:for-each instruction?
If so, you need to do something like this:

   <xsl:for-each select="@*">
      <xsl:variable name="outer" select="current()"/>
      <tr>
      <td><!-- lookup text for display in xml template -->
      <xsl:value-of select="$xmTmplt[@name=name($outer)]/text"/>
      </td>
   </xsl:for-each>

Dave


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


Current Thread