xsl-list
[Top] [All Lists]

Re: [xsl] length of string from a set of nodes.

2009-03-27 13:57:27
Fred Christian wrote:
I was able to get this to work, but while reading about it, I see all these little tips and recommendations regarding being efficient and not creating nodes when you only need strings.

In this code my goal was meet of deciding if the length of all the text concatenated together is greater than 30. <xsl:variable name="strings" as="xs:string"><xsl:value-of select="answers"/></xsl:variable>

Couldn't you simply do
<xsl:variable name="strings" as="xs:string" select="string-join(answers, ' ')"/>
?

<xsl:variable name="slen" as="xs:integer"><xsl:sequence select="string-length($strings)"/></xsl:variable>

That could certainly be done as
<xsl:variable name="slen" as="xs:integer" select="string-length($strings)"/>


--

        Martin Honnen
        http://JavaScript.FAQTs.com/

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

<Prev in Thread] Current Thread [Next in Thread>