This does look kinda spooky - am not sure of the answer. It looks like
expressions are throwing the whitespace handling out of whack. There were a
whole bunch of JUnit (or JellyUnit tests for this kind of thing but I can't
seem to find them right now.


You can turn on and off whiltespace trimming, which is on by default. Also
there's a <whitespace> tag that preserves whitesapce.

So you can do

<foo>
    <a>
                hello
    </a>


    </b>
        <j:whitespace> hello <j:whitespace>
    </b>

</foo>

which will output by default

<foo><a>hello</a><b> hello </b></foo>

Unless you disable whitespace trimming by specifying trim="false" attribute
on a tag. You can also pipe the output of your script into an XML pretty
printer if you wish. e.g.

<j:file name="foo.xml" prettyPrint="true">
<foo>
    <a>
                hello
    </a>


    </b>
        <j:whitespace> hello <j:whitespace>
    </b>

</foo>
</j:file>

Which would output...

<foo xmlns="dummy>
  <a>hello</a>
  <b>hello</b>
</foo>

James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: "Christian Sell" <[EMAIL PROTECTED]>
To: "Jakarta Commons Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, January 22, 2003 5:43 PM
Subject: Re: [jelly] question


> James Strachan wrote:
> > From: "Christian Sell" <[EMAIL PROTECTED]>
> >
> >>>- is interpreted by the expression language as numerical subtraction.
> >>>
> >>>e.g.
> >>>
> >>>${foo- 12}
> >>
> >>does that mean that variable names have to follow naming rules similar
> >>to Java? (If so, the set tag should enforce them like the Java compiler
> >>does)
> >
> >
> > Variables don't have to be. e.g. if you want to access some illegally
named
> > variable you could do
> >
> > ${context.getVariable('some-bad-name*of/a.variable'}
> >
> > Though I think testing variable names (or at the very least warning
users)
> > in tags like <j:set var=.../> seems like a good idea to me.
>
>
> that leaves me with 2 questions:
>
> 1. how do I output a simple message to the console, followed by a
> carriage return, without a "[WARN] adada" prefix, without configuration
> of log4j.properties, without unwanted whitespace.
>
>
> 2. the handling of tag content seems rather obscure. If I write this:
>
> <j:jelly xmlns:j="jelly:core" xmlns:log="jelly:log">
>
>      <j:set var="repeat_count" value="5"/>
>
>      repeat_count=${repeat_count}
>
>      <log:info>testest</log:info>
>
> </j:jelly>
>
> my output is:
>
> ===== begin output ========
>
>
>      repeat_count=5
>
> [INFO] InfoTag - -testest
> ====== end output =========
>
> but if I write
>
> <j:jelly xmlns:j="jelly:core" xmlns:log="jelly:log">
>
>      <j:set var="repeat_count" value="5"/>
>
>      repeat_count
>
>      <log:info>testest</log:info>
>
> </j:jelly>
>
> my output is:
>
> ===== begin output ========
> [INFO] InfoTag - -testest
> repeat_count
> ====== end output =========
>
>
> Note the only difference is the removal of the ${repeat_count}
> expression in the second script.
>
> - Christian
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to