This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
links in xsl:for-each
- To: XSL-List at mulberrytech dot com
- Subject: links in xsl:for-each
- From: Kris Paelman <kpaelman at telin dot rug dot ac dot be>
- Date: Wed, 29 Mar 2000 19:03:09 +0200 (CEST)
- Reply-To: xsl-list at mulberrytech dot com
Hello,
Another newbie question:
Since I found the following link in one of the newbee mails,
http://metalab.unc.edu/xml/books/bible/updates/14.html#XSL
I checked it out and tried to solve my problem, but I failed.
I have records in XML-format and I'm trying to add hyperlinks to the
<TITLE> field of my records. Using a for-each statement, I'm forced to use
parameter passing since every title needs another hyperlink.
Based on what I've found on the site described earlier, I've made the
following of it, but without succes :
I've extended every record with a ANCHOR field.
....
<xsl:for-each select="/FILE/RECORD">
<TR>
<TD >
<font color="indigo">
<xsl:apply-templates select="DATE/text()"/>
</font>
</TD>
<xsl:template match="ANCHOR">
<xsl:call-template name="HYPERLINK">
<xsl:with-param name="link">
</xsl:with-param>
<xsl:value-of select="."/>
</xsl:call-template>
</xsl:template>
<TD >
<xsl:apply-templates select="ORIG_TITLE/text()"/>
</TD>
....
At the end of the file :
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="*">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template name="HYPERLINK">
<xsl:with-param name="link"></xsl:with-param>
<td>
<font SIZE="5" color="red">
<b>
<a href="{$link}">xsl:value-of select="."/></a>
</b>
</font>
</td>
</xsl:template>
</xsl:stylesheet>
And the error message :
-----------------------
Keyword xsl:template may not be used here.
Kind regards,
Kris Paelman
Belgian student.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list