Basic question in XSL regarding preceding text

Posted by Rachel on Stack Overflow See other posts from Stack Overflow or by Rachel
Published on 2010-05-27T20:58:44Z Indexed on 2010/05/27 21:01 UTC
Read the original article Hit count: 199

Filed under:
|
|

I am new to XSL and i have a basic question on the context of using preceding text. My template match is on the text node. I am iterating over an xml file and within my for loop i am trying to take the preceding text of the text node. Unfortunately preceding::text() is not working if i use it within a for loop. I want to use it within the for loop but how can do it?

<xsl:template match="text()"> 
<xsl:variable name="this" as="text()" select="."/>   
  <xsl:for-each select="$input[@id = generate-id(current())]"> 
  <xsl:variable name="preText" as="xsd:integer" select="sum(preceding::text()[. >> //*[@id=@name]]/string-length(.))"/> 
  ... 
  ...
  </xsl:for-each> 
 </xsl:template>  

© Stack Overflow or respective owner

Related posts about xslt

Related posts about xsl