Gerhard Hipfinger wrote:
...
XSLT questions are best asked on the XSL list, for some
obvious reasons.
  http://www.mulberrytech.com/xsl/xsl-list/

>      <text name="/page/article/header" size="60"/>
...
>    <input type="text" name="{@name}" size="{@size}">
 >     <xsl:attribute name="value"><xsl:value-of select="@name"/></xsl:attribute>
...
> then the output of the value field is "/page/article/header"

You get what you ask for: the content of the @name attribute.
The processor won't interpret it as an XPath and evaluate it
again just because it looks like a good idea to you. There is
nothing magic about using xsl:attribute.

> Is it possible to get the content of a subnode in such a way?

Not in standard XSLT. Most processors have an extension function
called evaluate() or something similar, which takes a string as
parameter and evaulates the string as XPath expression:
    <input type="text" name="{@name} value="{xx:evaluate(@name)}" size="{@size}">
Consult the manual of your processor for the details. This will
make your style sheet non-portable. Therefore better yet:

> Have 
> someone another solution for this kind of problem?

You should use names/ids for crossreferences in you XML instead of
XPath expressions:
<page>
  <article>
    <header id="id1">foo</header>
    <leadin>bar</leadin>
  </article>
  <form>
    <text name="id1" size="60"/>
  </form>
</page>

Use in XSL:
   <xsl:key name="value" match="*" use="@id"/>
    ...
    <input type="text" name="{@name} value="{key('value',@name)}" size="{@size}">

If you are using XForms, well, you're stuck with evaluate().

J.Pietschmann


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to