Alex Muir wrote:
<xsl:variable name="lines" as="element()*">
<xsl:analyze-string select="text()" regex="§">
<xsl:non-matching-substring>
<xsl:element name="line">
<xsl:attribute name="length"
select="string-length(normalize-space(.))"/>
<xsl:attribute name="text" select="."/>
</xsl:element>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:variable>
I can get the average like so including the last line
<xsl:variable name="averageLineLength"
select="round(avg($lines/@length))" as="xs:double"/>
I can get the last line length without error
<xsl:variable name="averageLineLength"
select="round(avg($lines[last()]/@length))" as="xs:double"/>
However in the case where my number lines is greater than 2 <xsl:when
test="$numberLines ge 2"> I don't want to include the last line as
part of my count and was trying the following
<xsl:variable name="averageLineLength"
select="round(avg($lines[last()]/preceding-sibling::node()/@length))"
as="xs:double"/>
Which gives me the error:
Description: An empty sequence is not allowed as the value of variable
$averageSpaceNormalizedLineLength
I don't see any code with a variable named
"averageSpaceNormalizedLineLength" in your snippets above so it seems as
if you have not posted the relevant code.
--
Martin Honnen
http://msmvps.com/blogs/martin_honnen/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--