[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsl:value-of not allowed inside a stylesheet

Subject: Re: xsl:value-of not allowed inside a stylesheet
From: Jarkko.Moilanen@xxxxxx
Date: Fri, 17 May 2002 13:19:50 +0300 (EEST)
e1edff
The situation is that I compile the html file from several xsl and one xml 
file. The value-of causes XSLT error, in the variable NumberOfMessages 

"Compiler" file:
<xsl:stylesheet version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<!-- used variables declaration -->
	<xsl:import href="Variables.xsl" />
	<!-- Build header of page -->
	<xsl:import href="Header.xsl" />
	<!-- Build sorting arrows -->
	<xsl:import href="Sorting.xml" />
	<!-- Build the topic listing -->
	<xsl:import href="TopicList.xsl" />

<xsl:output method="html" encoding="ISO-8859-1" indent="yes" />		
	<xsl:template match="/">	
		<html>
		<xsl:apply-imports/>
		</html>
	</xsl:template>
	<xsl:template match="Subject">	
		<xsl:value-of select="concat(substring(., 1, 55),
		substring('...', 1 div (string-length(.) > 55), 3))" />
	</xsl:template>
</xsl:stylesheet>

Variables file:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:variable name="status">
  		<xsl:for-each select="Document/Information">
    		<xsl:sort select="Time" order="ascending" />
		<xsl:sort select="Clock" order="ascending" />
		<xsl:if test="position() = last()">	
		<xsl:value-of select="@SignStatus" />
		</xsl:if>
		</xsl:for-each>
	</xsl:variable>

	<xsl:variable name="recent">
  		<xsl:for-each select="Document/Information">
    		<xsl:sort select="Time" order="ascending" />
		<xsl:sort select="Clock" order="ascending" />
		<xsl:if test="position() = last()">	
		<a href="html?{Subject/@id}{Subject/@id2}">
		<xsl:apply-templates select="Subject" /></a>
		</xsl:if>
		</xsl:for-each>
	</xsl:variable>

	<xsl:variable name="sender">
  		<xsl:for-each select="Document/Information">
    		<xsl:sort select="Time" order="ascending" />
		<xsl:sort select="Clock" order="ascending" />
		<xsl:if test="position() = last()">	
		<xsl:value-of select="Sender" />
		</xsl:if>
		</xsl:for-each>
	</xsl:variable>
	
	<xsl:variable name="NumberOfMessages">
		<xsl:for-each select="Document">
		<xsl:value-of select="count(Information)" />
		</xsl:for-each>
	</xsl:variable>
</xsl:stylesheet>

Header file, that uses varibles (part of it):
<xsl:stylesheet version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
		<table width="800" height="20" border="0" cellspacing="2" 
                 cellpadding="2" bgcolor="white">
		
		<tr>
		<td width="148" valign="top" bgcolor="#E1EDFF">
                <p><b>Message count= </b><xsl:value-of            
select="$NumberOfMessages" />
                </p> </td>
		
		<td  width="58" valign="top" align="left" bgcolor="#E1EDFF">
		<p><b>Recent: </b>
                </p>
		</td>
		<xsl:comment>The recent message subject is found by variable "recent" in
Variables.xsl</xsl:comment>
		<td  width="360" valign="top" bgcolor="#E1EDFF"><p>
		<xsl:copy-of select="$recent" /></p>
      		</td>
		
		<xsl:comment>The recent message's status is found by variable "status" in
Variables.xsl</xsl:comment>
		<td  width="63" valign="top" bgcolor="#E1EDFF"><p ID="Status">
		<xsl:value-of select="$status" /></p>
      		</td>
		<xsl:comment>The recent message's sender is found by variable "status" in Variables.xsl</xsl:comment>		
		<td  width="155" valign="top" bgcolor="#E1EDFF"><p>
		<font size="-2"><xsl:value-of select="$sender" /></font>
		</p></td>
		</tr></table><br></br>

</xsl:stylesheet>


******************************************************************
Jarkko Moilanen         *You are wise, witty, and wonderful,     *
Researcher/ ITCM        *but you spend too much time             *
jm60697@xxxxxx          *reading this sort of trash.             *
www.uta.fi/~jm60697     *                                        *
GSM: +358 50 3766 927   *                                        *
******************************************************************
* ITCM | Information Technology and Crisis Management            *
* http://www.itcm.org                                            *
******************************************************************

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.