This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: links in xsl:for-each


Although I cannot see it in your code, the 
reason for  

Keyword xsl:template may not be used here. 

is that you are not allowed to nest xsl:template 
within an xsl:template

ie  

<xsl:template match="ANCHOR">
	<xsl:call-template name="HYPERLINK">
		<xsl:template match="text">
			<xsl:with-param name="link">
			</xsl:with-param>
		</xsl:template>	
			<xsl:value-of select="."/>
	</xsl:call-template>
</xsl:template>


Eddy


-----Original Message-----
From: Kris Paelman [mailto:kpaelman@telin.rug.ac.be]
Sent: Wednesday, March 29, 2000 12:03 PM
To: XSL-List@mulberrytech.com
Subject: links in xsl:for-each


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


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]