I'm coding my first website using XML+XSL. The xml I am transforming have this section:
<page>
<news>
<highlights>
<entry>
<mini>x_thumb.jpg</mini>
<title>title</title>
<text>text</text>
<image>x.jpg</image>
<link>x.html</link>
</entry>
<entry>
<mini>z_thumb.jpg</mini>
<title>title</title>
<text>text</text>
<image>z.jpg</image>
<link>z.html</link>
</entry>
<entry>
<mini>y_thumb.jpg</mini>
<title>title</title>
<text>text</text>
<image>y.jpg</image>
<link>y.html</link>
</entry>
</highlights>
</news>
</page>
In my .xsl file I want to select the first entry because I'm doing a jQuery image rotator and I need the "default" image to show it. So I coded:
<?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="/">
[...]
<xsl:template match="page/news/highlights/entry[1]">
<div class="main_image">
<img>
<xsl:attribute name="src">
<xsl:value-of select="image" />
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="title" />
</xsl:attribute>
</img>
<div class="desc">
<div class="block">
<p>
<xsl:value-of select="text" />
</p>
</div>
</div>
</div>
</xsl:template>
[...]
And I can't get it working. I've tried various ways, like:
<xsl:value-of select="page/news/highlights/entry[1]/image" />
An no way... How can I do it?
Thanks in advance!