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

RE: global variable and position() once more

Subject: RE: global variable and position() once more
From: fe.sola@xxxxxxxxxxxxxx
Date: Thu, 4 Sep 2003 18:24:38 -0400
html text position
Hello, sorry for this late reply, this email got buried among others and after a major 
clean up I ran into it...
I understand now why it wasn't working, but anyway as the xslt has to be applied to 
several input files, taking the position of the nodes for reference is prone to error, 
finally I followed Dimitre's suggestion of using keys and am still working on it (the 
email with the solution is in another thread). 
Dimitre's solution uses the exslt function node-set() and so far I'm unable to debug the 
stylesheet with the XMLSpy :\ The solution so far fails with some input files and works 
fine with other group, I presume it is due to an extra <hr> or <br> tag...
Lizet 
Mensaje citado por Michael Kay <mhk@xxxxxxxxx>:

>  <xsl:apply-templates select="text()[position()>$descPos]"/>
> 
> That won't work, it's only selecting text nodes that are children of the
> html element, and they are all white space.
> 
> Anyway, $descPos isn't a position, it's a text node.
> 
> If $descPos2 were defined as
> 
> <xsl:variable name="descPos2"
> select="count($descPos/preceding::text()+1)"/>
> 
> then you could select all text nodes that follow it using:
> 
> select="(//text)[position() > $descPos2]
> 
> but you can do that much more easily as:
> 
>   <xsl:apply-templates select="$descPos/following::text()"/>
> 
> However, I suspect you don't only want to process the text nodes, you
> also want to process their containing elements.
> 
> Trouble is, I'm not really sure what you DO want to do.
> 
> Michael Kay
> 
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> > fe.sola@xxxxxxxxxxxxxx
> > Sent: 28 August 2003 16:54
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: RE:  global variable and position() once more
> > 
> > 
> > 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
> > 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 




-------------------------------------------------
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

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.