[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] problem with variable and position()


Subject: [xsl] problem with variable and position()
From: fe.sola@xxxxxxxxxxxxxx
Date: Wed, 27 Aug 2003 02:30:46 -0400

This is part of the stylesheet...


<xsl:template match="html">
	      <xsl:apply-templates select="head"/>
	      <xsl:apply-templates select="body"/>
</xsl:template>
	

<xsl:template match="head"/>
<xsl:template match="body">
                    <xsl:element name="description">
                       <xsl:apply-templates select="text()[starts-with(normalize-space
(),'Description')]" mode="description"/>
                    </xsl:element>
</xsl:template>
<xsl:template match="text()[starts-with(normalize-space(),'Description')]" 
mode="description">
                         <xsl:variable name="descPos" select="position()"/>
                         <xsl:apply-templates select="text()[position()>$descPos]"/>
                                           
</xsl:template>
<xsl:template match="text()[position()>$descPos]">
                              <xsl:value-of select="."/>
</xsl:template>  
 
I have an xhtml document with a description as a text element in the body. This 
description text start with the word "Description" and it has a variable position inside 
the input documents. I tried to store the position of the description text in the 
descPos variable to use it later, but the above stylesheet gives me an error of "Invalid 
variable reference". How could I re-write the last template so I avoid this error? 
tia,
lizet  

-------------------------------------------------
Este mensaje fue enviado usando el servicio de correo en web de Infomed
http://webmail.sld.cu

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



Current Thread
Keywords