Amara xslt & xsl:strip-space [Was: Extra line break with xslt processor]

5 views
Skip to first unread message

Luis Miguel Morillas

unread,
Aug 6, 2012, 2:56:17 AM8/6/12
to akar...@googlegroups.com
These are the result of my test:

doc.xml
=======

<?xml version="1.0"?>
<document>
<text> </text>
<text>a </text>
<text> a</text>
<text> a </text>
</document>


doc.xslt
========
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>

<xsl:strip-space elements="*"/>

<xsl:template match="/">
<xsl:apply-templates select="//text"/>
</xsl:template>

<xsl:template match="text">
Chars: <xsl:value-of select="string-length(text())"/>
</xsl:template>

</xsl:stylesheet>

Result with saxon:
================
Chars: 0
Chars: 3
Chars: 3
Chars: 3

Result with amara xslt processor:
============================
Chars: 3
Chars: 3
Chars: 3
Chars: 3

So I'm afraid there is a bug with Amara xslt processor.

lm


2012/8/6 Luis Miguel Morillas <mori...@gmail.com>:
> 2012/8/5 Uche Ogbuji <uc...@ogbuji.net>:
>> On Fri, Aug 3, 2012 at 11:11 AM, Luis Miguel Morillas <mori...@gmail.com>
>> wrote:
>>>
>>> I'm working with this xslt transform http://paste2.org/p/2093093 The
>>> result of the processor is http://paste2.org/p/2093095 I think
>>> amara's xslt processor adds line feeds. Is it ok? The result with
>>> xsltproc is http://paste2.org/p/2093096
>>>
>>> Is it a bug or is something wrong with the stylesheet (or I'm I not
>>> understandig it :-P)
>>
>>
>> I'd hoped to find time to delve into the code here, but I think what's
>> happening is not that amara is adding linebreaks but that it's not applying
>> the xsl:strip-space command. Out of curiosity, if you remove that, does the
>> xsltproc result match the Amara result?
>>
>> Even though this one might be an Amara bug, in general xsltproc is a very
>> bad processor to use to figure out correct behavior. Its standards
>> compliance is rather poor. It's better to compare to Saxon.
>>
>
> Ok. This is the Saxon result with xsl:strip-space command [1] I think
> Amara's not running ok the xsl:strip-space command (same result as
> Saxon without xsl:strip-space command) I'll investigate better
> tomorrow with other tests.
>
>
> [1] http://paste2.org/p/2095676
>
>
> -- lm
>
>
>>
>> --
>> Uche Ogbuji http://uche.ogbuji.net
>> Weblog: http://copia.ogbuji.net
>> Poetry ed @TNB: http://www.thenervousbreakdown.com/author/uogbuji/
>> Founding Partner, Zepheira http://zepheira.com
>> Linked-in: http://www.linkedin.com/in/ucheogbuji
>> Articles: http://uche.ogbuji.net/tech/publications/
>> Friendfeed: http://friendfeed.com/uche
>> Twitter: http://twitter.com/uogbuji
>> http://www.google.com/profiles/uche.ogbuji
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Akara Developers" group.
>> To post to this group, send email to akar...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> akara-dev+...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/akara-dev?hl=en.

Uche Ogbuji

unread,
Aug 6, 2012, 9:35:14 AM8/6/12
to akar...@googlegroups.com
That's what I thought. Could you compile the info you gathered into a ticket?


You could also add your new test to the suite if you like.

Thanks.

--Uche

Luis Miguel Morillas

unread,
Aug 6, 2012, 10:31:22 AM8/6/12
to akar...@googlegroups.com
2012/8/6 Uche Ogbuji <uc...@ogbuji.net>:
> That's what I thought. Could you compile the info you gathered into a
> ticket?
>
> https://github.com/zepheira/amara/issues
>

Ok.

> You could also add your new test to the suite if you like.
>

Sure, I have some ready. Uche, how should I send changes for the git
repo? I rememeber I used to send to you mercurial bundles before we
use git.

Regards,


lm

Uche Ogbuji

unread,
Aug 6, 2012, 12:19:10 PM8/6/12
to akar...@googlegroups.com
On Mon, Aug 6, 2012 at 8:31 AM, Luis Miguel Morillas <mori...@gmail.com> wrote:
2012/8/6 Uche Ogbuji <uc...@ogbuji.net>:


Ok.

> You could also add your new test to the suite if you like.
>

Sure, I have some ready. Uche, how should I send changes for the git
repo?  I rememeber I used to send to you mercurial bundles before we
use git.

Yes I unfortunately also had to learn a bit of git, though I much prefer mercurial.  Now however I just use the github UI, which makes my life easier. The UI has some nice facilities for creating and applying pull requests, which is probably the best way to proceed. There are good tutorials & videos on github for that.

Luis Miguel Morillas

unread,
Aug 7, 2012, 10:49:25 AM8/7/12
to akar...@googlegroups.com
2012/8/6 Uche Ogbuji <uc...@ogbuji.net>:
> On Mon, Aug 6, 2012 at 8:31 AM, Luis Miguel Morillas <mori...@gmail.com>
> wrote:
>>
>> 2012/8/6 Uche Ogbuji <uc...@ogbuji.net>:
>>
>>
>> Ok.
>>
>> > You could also add your new test to the suite if you like.
>> >
>>
>> Sure, I have some ready. Uche, how should I send changes for the git
>> repo? I rememeber I used to send to you mercurial bundles before we
>> use git.
>
>
> Yes I unfortunately also had to learn a bit of git, though I much prefer
> mercurial. Now however I just use the github UI, which makes my life
> easier. The UI has some nice facilities for creating and applying pull
> requests, which is probably the best way to proceed. There are good
> tutorials & videos on github for that.
>
>

Maybe using fork & pull request [1] is the best way of collaboration for us ?


[1] https://help.github.com/articles/using-pull-requests/

lm
Reply all
Reply to author
Forward
0 new messages