xsl-list
[Top] [All Lists]

RE: newbie question

2002-09-24 15:00:03
From: Markus Jais [mailto:markusjais(_at_)yahoo(_dot_)de]
Sent: Tuesday, September 24, 2002 3:19 PM
Subject: [xsl] newbie question



but I do not understand. why are the contents of the <english_name>,
<german_name> and <prey> printed and why is value="" ??

value-of returns the contents of your select expression, which is evaluated
as a string.  If the expression returns a node-set (as in your example),
value-of ignores any children elements and their attributes and just returns
the text, or nothing if the element is empty.

and that "{comment}" would access the value of the "comment" 
attribute.

First, you haven't defined an XSLT variable anywhere to hold the textual
value of comment, i.e.:

<xsl:for-each select="/birds/eagles">
  <xsl:variable name="comment" select="species/@comment"/>

Then you need to properly reference the variable in your markup:

  <input type="text" name="bla" value="{$comment}"/> <!-- note $ token -->
</xsl:for-each>

hth,
b.

| brian martinez                              
brian(_dot_)martinez(_at_)trip(_dot_)com |
| senior gui programmer                                  303.708.7248 |
| trip network, inc.                                 fax 303.790.9350 |
| 6436 s. racine cir.                             englewood, co 80111 |
| http://www.cheaptickets.com/                   http://www.trip.com/ |

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



<Prev in Thread] Current Thread [Next in Thread>