RE: [xsl] Defining a key on a RTF inside a Template

Subject: RE: [xsl] Defining a key on a RTF inside a Template
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 8 Dec 2004 08:53:26 -0000
> According to XSLT 1.0 specificatoion ( 
> http://www.w3.org/TR/1999/REC-xslt-19991116 ), xsl:key is a
> top-level element. Therefore you cannot place it outside a 
> xsl:stylesheet/xsl:transform .
> The easiest solution: do not use keys.

No, it's perfectly OK to use keys to search within an RTF.

Michael Kay
http://www.saxonica.com/

> 
> --- "Ranjan K. Baisak" <ranjanbaisak@xxxxxxxxx> wrote:
> 
> > I am creating  a key inside a template with RTF as
> > below:
> > <xsl:variable name="projectSum">
> > 	<xsl:for-each select="//project">
> > 		<xsl:variable name="projectname" select="./@name"/>
> > 		<xsl:variable name="projectid" select="@id"/>
> > 		<xsl:variable name="projectref"
> > select="projectelement/@ref"/>
> > 		<xsl:copy>
> > 			<xsl:copy-of select="./@name"/>
> > 			<xsl:copy-of select="./@id"/>
> > 			<projectsum>
> > 				<xsl:copy-of
> > select="count(key('ProjectPartNumber',$projectref))"/>
> > 			</projectsum>
> > 		</xsl:copy>
> > 	</xsl:for-each>
> > </xsl:variable>
> > 
> > <xsl:key name="countDetail"
> > match="exslt:node-set($projectSum)/projectsum"
> > use="./@id"/>
> > 
> > In XALAN it throws error with message "Incorrect place
> > of defining Key".
> > I am not sure whether it is possible to create a key
> > with RTF within a template?
> > If not possible, is there any otherway to achive the
> > same functionality?
> > 
> > regards,
> > Ranjan
> > 
> > 
> > 
> > 		
> > __________________________________ 
> > Do you Yahoo!? 
> > Yahoo! Mail - now with 250MB free storage. Learn more.
> > http://info.mail.yahoo.com/mail_250
> > 
> > 
> 
> 
> =====
> Marian
> http://www.utdallas.edu/~mgo031000/
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Mail - Find what you need with new enhanced search.
> http://info.mail.yahoo.com/mail_250

Current Thread