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

RE: [xsl] global variable and position() once more


Subject: RE: [xsl] global variable and position() once more
From: fe.sola@xxxxxxxxxxxxxx
Date: Thu, 28 Aug 2003 11:53:40 -0400

Hello, being a newbie is a pain...
I decided to try Michael Kay's suggestion of using a global variable. My problem is that 
I need to select the text nodes after a text node that starts with the 
word 'Description'.
The xhtml looks more or less like this: (This is a simplified sample version, could 
provide the real one on request)

<html>
   <head>
      <!--Something here-->
   <head>
   <body>
        blah bla blah
        <table>
          <!-- something here-->
        </table>
        Description
        <table>
          <!-- something here-->
        </table>
        text nodes to select with the description text
        
   </body>
</html>  

My xsl stylesheet looks like this:
...
<xsl:template match="/">
                ... 
		<Document>
		    <xsl:apply-templates select="html"/>
		</Document>
                ...  
</xsl:template>
...
<xsl:variable name="descPos" select="//text()[starts-with(normalize-space
(),'Description')]"/>
...
<xsl:template match="html">
                <xsl:element name="description">
                       <xsl:apply-templates select="text()[position()>$descPos]"/>
                </xsl:element>
...
</xsl:template>
...
I can't manage to store in the descPos global variable the position of the node that 
starts with 'Description', when I try select="//text()[starts-with(normalize-space
(),'Description')position()] or try to get the position function somewhere in that XPath 
expression I get errors.
So far the descPos variable gets a wrong value, always 1 and the mentioned text node has 
a position 30 or more on some other input documents.
thanks a lot for looking at this, 
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