You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mariusz Nowostawski <ma...@marni.otago.ac.nz> on 2000/03/28 11:54:57 UTC

This page was served in ...

Hi all,

I have two questions, first:
I am producing (formatting XML to) some ascii script using text/plain, and
it works pretty good, but at the and of the stream I have always :
<!-- This page was served in 268 milliseconds by Cocoon 1.6.1 -->
How I can configure the formatter not to add this line to the output?
It is fine for HTML formatting, but I cannot have it inside the produced
ascii script.

Second question is probably not that much related to Cocoon as to XSL
itself. If I have something like:

<tag1>
arbitrary text
</tag1>
and call text() on the context element I am getting "arbitrary text" as
expected. If I have:

<tag1>
arbitrary text
<innertag/>
</tag1>

text() is still returning expected text. However, if I have:

<tag1>
<innertag/>
arbitrary text
</tag1>

text() is returning either empty EOL or some spaces + EOL character. I
tried child::text() and even going throuhg all children of tag1 via
for-each but I could not anyhow get exptected "arbitrary text". What
expression I should use (for Cocoon) to return a concatenation of all text
nodes? To me child::text() or just text() should work in the last case as
well - is it an implementation issue or I am missusing text() ?

Oo, I have a third question ;o)  Is there "out there" a standard function
for string (in XSL and friends) to make from string like that:

some "string" with
EOL characters

string like:

some \"string\" with\nEOL characters

? I couldn't find one in specs.


thanks in advance
with best regards
Mariusz


ps. Cocoon really rocks ;o)


Re: This page was served in ...

Posted by Phil Lanch <ph...@aldigital.co.uk>.
Mariusz Nowostawski wrote:
> 
> itself. If I have something like:
> 
> <tag1>
> arbitrary text
> </tag1>
> and call text() on the context element I am getting "arbitrary text" as
> expected. If I have:
> 
> <tag1>
> arbitrary text
> <innertag/>
> </tag1>
> 
> text() is still returning expected text. However, if I have:
> 
> <tag1>
> <innertag/>
> arbitrary text
> </tag1>
> 
> text() is returning either empty EOL or some spaces + EOL character. I
> tried child::text() and even going throuhg all children of tag1 via
> for-each but I could not anyhow get exptected "arbitrary text". What
> expression I should use (for Cocoon) to return a concatenation of all text
> nodes? To me child::text() or just text() should work in the last case as
> well - is it an implementation issue or I am missusing text() ?

text() is all the text-node children of the current node (i.e. tag1), so-

<xsl:apply-templates select="text()"/>

-should work.  however, when a node-set is converted to a string, the
result is the string value of just the first node in the set, so-

<xsl:value-of select="text()"/>

-doesn't work when tag1 has more than one text child; actually, it wasn't
guaranteed to work in your first example, because the parser can split a
bit of text in XML into as many text nodes as it likes (because that may be
more efficient for long bits of text).  you could use-

<xsl:value-of select="."/>

-since the string value of an element node is the concatenation of all its
text-node descendants.

-- 

cheers

phil

"When Alkan said, 'How are you?' the question had a total nuance:
he really wanted to know how you were, although at the same time
he was asking the question purely for the sake of social from.
Yet he managed simultaneously to acknowledge both of these
conflicting messages and still reformulated the question so that
it incorporated them and yet was devoid of all assumptions.
Furthermore none of the above seemed to be _implied_."