Using xsl:analyze-string in Saxon 8

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Using xsl:analyze-string in Saxon 8

Mark Gabriel-2
Hello,

I have been using the following bit of XSL code to insert paragraphs into my
text string to display where the user hit return in their text box:

<xsl:analyze-string select="." regex="[^&#xD;]*&#xD;">
        <xsl:matching-substring>
                <p>
                        <xsl:value-of select="."/>
                </p>
        </xsl:matching-substring>
        <xsl:non-matching-substring>
                <p>
                        <xsl:value-of select="."/>
                </p>
        </xsl:non-matching-substring>
</xsl:analyze-string>

It works fine on short strings, but when my sting length gets too long (790
characters should do it) I get a stack overflow.

I have been testing with xmlSpy using saxon8.jar as an external
transformation program.

Does anybody else get this problem or am I doing something silly?

Mark G




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

Re: Using xsl:analyze-string in Saxon 8

David Carlisle

> I have been using the following bit of XSL code to insert paragraphs into my
>  text string to display where the user hit return in their text box:

Does that work? (even when it doesn't overflow)
You are searching for #xD but you can't get that into an XSLT input by
"hitting the return key" as any newlines (in mac/windows/unix
conventions) are always normalised by an XML parser to a single #xA.
(#10).

The regexp handler would probably have an easier time of it if you
inverted the test and
<xsl:analyze-string select="." regex="&#10;">
I would say then swap round your <xsl:matching-substring> and
<xsl:non-matching-substring> codes, excpet they are the same in your
case.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

RE: Using xsl:analyze-string in Saxon 8

Michael Kay
In reply to this post by Mark Gabriel-2

I'm a little surprised you should get a stack overflow on this: could you
please send a complete working example that illustrates the problem.

Michael Kay
http://www.saxonica.com


>
> I have been using the following bit of XSL code to insert
> paragraphs into my
> text string to display where the user hit return in their text box:
>
> <xsl:analyze-string select="." regex="[^&#xD;]*&#xD;">
> <xsl:matching-substring>
> <p>
> <xsl:value-of select="."/>
> </p>
> </xsl:matching-substring>
> <xsl:non-matching-substring>
> <p>
> <xsl:value-of select="."/>
> </p>
> </xsl:non-matching-substring>
> </xsl:analyze-string>
>
> It works fine on short strings, but when my sting length gets
> too long (790
> characters should do it) I get a stack overflow.
>
> I have been testing with xmlSpy using saxon8.jar as an external
> transformation program.
>
> Does anybody else get this problem or am I doing something silly?
>
> Mark G
>
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App
> Server. Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help