This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
newbie question
- From: Markus Jais <markusjais at yahoo dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: 24 Sep 2002 23:18:37 +0200
- Subject: [xsl] newbie question
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hello
I have just started reading "beginning XSLT" from Wrox and I played
a little bit with the examples and tried them on my own xml files.
here is my xml file:
-------------
<?xml version="1.0"?>
<birds>
<eagles>
<species comment="seldom, in Germany only in the alpes">
<english_name>Golden Eagle</english_name>
<german_name>Steinadler</german_name>
<prey>Birds, Mammals</prey>
</species>
</eagles>
<falcons>
<species comment="seldom">
<english_name>Perigrine Falcon</english_name>
<german_name>Wanderfalke</german_name>
<prey>Birds</prey>
</species>
</falcons>
<woodpeckers>
<species comment="greatest woodpecker in Europe">
<english_name>Black Woodpecker</english_name>
<german_name>Schwarzspecht</german_name>
<prey>insects, especially ants</prey>
</species>
</woodpeckers>
</birds>
-------------
and here is the xsl file:
---------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="/birds/eagles">
<xsl:value-of select = "." />
<input type="text" name="bla" value="{comment}"/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
----------------
I ran the example with xsltproc from libxslt 1.0.20 and with saxon 6.5.2
on RedHat 7.3
I get this output:
<html><body>
Golden Eagle
Steinadler
Birds, Mammals
<input type="text" name="bla" value="">
</body></html>
but I do not understand. why are the contents of the <english_name>,
<german_name> and <prey> printed and why is value="" ??
I thought that /birds/eagles would result in the species node.
and that "{comment}" would access the value of the "comment" attribute.
can anybody explain what is going on here ?
thanks
markus
__________________________________________________________________
Gesendet von Yahoo! Mail - http://mail.yahoo.de
Yahoo! präsentiert als offizieller Sponsor das Fußball-Highlight des
Jahres: - http://www.FIFAworldcup.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list