Basic question in XSL regarding preceding text
- by Rachel
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>