RE: [xsl] call-template from href NO SERVER INVOLVED ???

Subject: RE: [xsl] call-template from href NO SERVER INVOLVED ???
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Mon, 17 Nov 2003 23:59:49 -0000
> HELP!  This brick wall is too big and I'm running out
> of time.

You will need to find more time. You're nowhere near finished on this.
In fact, you've hardly started.

  I've included my .xsl file below.  The first
> template displays the names of the worksheet as
> hyperlinks.  
> I need to link to the second template to display the
> worksheet and my href doesn't appear to be working.

Templates don't display anything. They create result documents, in your
case HTML documents. How you get the documents displayed is another
matter entirely.

Your second template starts out by producing an <html> element. But this
isn't going in a new document, it is going in the middle of the <a>
element that's being generated when it's called. An <html> element in
the middle of an <a> element doesn't make sense in HTML, the browser
won't know what to do with it.  
> Right now all of the worksheets are in one xml file. 
> There is no server involved.  Everything is happening
> on the client.  Do I need an XSLT source such as Saxon
> or MSXML?

You obviously need an XSLT processor, and if you are doing everything in
the client then you need one that runs in your chosen web browser, which
I assume is MSXML.

In a client-side transformation in MSXML, you can't generate two HTML
documents from a single transformation. You have to generate one HTML
document in a first transformation, and the hyperlinks that it contains
have to be such that when the user clicks on them, another
transformation is fired off to produce another HTML document. There are
examples of this in my book XSLT Programmer's Reference and no doubt in
other XSLT books as well. You have to be prepared to write Javascript
code to run within the HTML page to control the transformation.

I hope this points you in the right direction.

Michael Kay

> Thank you so much,
> Patricia
> **************************************************
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="";
> xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
> xmlns:xlink="";
> xmlns:xptr="";>
> 	<xsl:variable 
> name="file">T1_CKHSJ7_50k-120@xxxxxxxxxxxxxxxxxxxxxxx</xsl:variable>
> 	<xsl:output method="html"/>
> 	<xsl:template match="/">
> 		<h2>
> 			<xsl:value-of select="$file"/>
> 		</h2>
> 			<THEAD>
> 				<TH>Worksheet Name</TH>
> 			</THEAD>
> 			<xsl:for-each select="ss:*/ss:Worksheet">
> 					<TD>
> <xsl:apply-templates select="Worksheet"/>
> 						<a>
> <xsl:attribute name="href">
> <xsl:call-template name="worksheetdata">
> <xsl:with-param name="sheetname"
> select="@ss:Name"/>
<xsl:value-of select="@ss:Name"/>
> 						</a>
> 					</TD>
> 				</TR>
> 			</xsl:for-each>
> 		</TABLE>
> 	</xsl:template>
> 	<xsl:template name="worksheetdata">
> 		<xsl:param name="sheetname"/>
> 		<html>
> 		<body>
> 		<center>
> 		<table border="2" width="100%">
> 		<xsl:for-each select="ss:*/ss:Worksheet">
> 			<xsl:if test="@ss:Name=string($sheetname)">
> 			<h1>This is a test</h1>
> 				<xsl:for-each select="ss:Table/ss:Row">
> 				<tr>
> 					<xsl:for-each select="ss:Cell">
> 					<td>
> 					<xsl:value-of
> select="ss:Data"/><xsl:text></xsl:text>
> 					</td>
> 					</xsl:for-each>
> 				</tr>
> 				</xsl:for-each>
> 			</xsl:if>
> 		</xsl:for-each>
> 		</table>
> 		</center>
> 		</body>
> 		</html>
> 	</xsl:template>
> </xsl:stylesheet>
> __________________________________
> Do you Yahoo!?
> Protect your identity with Yahoo! Mail AddressGuard 
>  XSL-List info and 
> archive:

 XSL-List info and archive:

Current Thread