You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Geir Magnusson Jr." <ge...@optonline.net> on 2001/12/16 21:05:27 UTC

[ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

I put into the whiteboard/geirm directory in CVS a .tgz containing a
Velocity-based tool called 'DVSL'.

DVSL is n XSLT-like XML transformation tool.

It is XSLT-like because  stylesheets are declarative in structure, defining
'output templates' for a given Xpath matching rule.

The good features :

- It uses Velocity as the template language

- It uses Xpath for node selection for template processing and navigation

- The stylesheet structure is almost identical to that of XSLT.

- Because it uses Velocity, binding to Java objects is trivial

In fact, the last point was the motivator - I have a client or two that use
XSLT to content generation in a Java server environment, and they are always
struggling to integrate other data sources in the processing.

Regarding the stylesheet, there is what seems so far to be a 100% Anakia vsl
compatible stylesheet for transforming existing Jakarta XML documentation
(there is a Velocity doc conversion example in the project in \examples).
This stylesheet was created by copying Craig's xsl version of the Anakia vsl
and just replacing the pointy bracket stuff with Velocity.  Same structure,
same xpath expressions.


What does a template look like?
===============================

Assume an XML document :

<?xml version="1.0"?>

<document>
  <section name="foo">
    <p>
       Hello from section foo
    </p>
  </section>
  <section name="bar">
    <p>
       Hello from section bar
    </p>
  </section>
</document>

Here's a stylesheet for DVSL :

#match("document")
<html>
  <body>
$context.applyTemplates()
  </body>
</html>
#end

#match("section")
<hr>
<b>Section:</b> $attrib.name
$context.applyTemplates("p")
#end

#match("p")
<blockquote>
$node.copy( $node.children() )
</blockquote>
#end


The output would be :

<html>
  <body>
<hr>
<b>Section:</b> foo
<blockquote>

       Hello from section foo
    
</blockquote>

<hr>
<b>Section:</b> bar
<blockquote>

       Hello from section bar
    
</blockquote>  

  </body>
</html>



I'd like people that are interested to play with it and give feedback.  I
would like to see it become a mini-project in Velocity-land (not part of the
core of course...) so we can nurture it and see where it goes.

It can replace Anakia right now for documentation rendering if we wanted to,
but I'm not proposing we do that yet - we need to make sure it works.
Jason is working on some PDF generation too.

It's a complete project - just untar.

  $ant jar

Will build the jar

  $ant docs

Will render the docs (using DVSL, of course) and those docs (1 page in
/docs) show more examples and cover the API a little bit better.

You can use it from the command line or from ant, or program something
yourself.  (Jason is helping me make a DVSL service for Turbine - I figured
I would contribute to that project sometime :)

There are a flight of examples in the /examples directory, including one
that shows how to use a toolbox to make data objects available.

So give it a look.  Be gentle, as the code is rather prototypeish, there
needs prollie much more javadoc and such, and I will continue to do that,
but wanted to get something out for interested people to play with.

Although I note it in the docs, I want to thank Jason, Jon and James
Strachan :  Jason and Jon for support, enthusiasm and using it, and James
for displaying tremendous patience when answering my dumb questions about
XSLT, dom4j and jaxen. Thanks.

geir

(Now I can get back to Velocity :)

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Nick Bauman <ni...@cortexity.com>.
This is very very very cool. I will strongly consider this technology in a 
project I'm working on now.

Geir wrote:

> 
> I put into the whiteboard/geirm directory in CVS a .tgz containing a
> Velocity-based tool called 'DVSL'.
> 
> DVSL is n XSLT-like XML transformation tool.
> 
> It is XSLT-like because  stylesheets are declarative in structure,
> defining 'output templates' for a given Xpath matching rule.
> 
> The good features :
> 
> - It uses Velocity as the template language
> 
> - It uses Xpath for node selection for template processing and
> navigation
> 
> - The stylesheet structure is almost identical to that of XSLT.
> 
> - Because it uses Velocity, binding to Java objects is trivial
> 
> In fact, the last point was the motivator - I have a client or two that
> use XSLT to content generation in a Java server environment, and they
> are always struggling to integrate other data sources in the
> processing.
> 
> Regarding the stylesheet, there is what seems so far to be a 100%
> Anakia vsl compatible stylesheet for transforming existing Jakarta XML
> documentation (there is a Velocity doc conversion example in the
> project in \examples). This stylesheet was created by copying Craig's
> xsl version of the Anakia vsl and just replacing the pointy bracket
> stuff with Velocity.  Same structure, same xpath expressions.
> 
> 
> What does a template look like?
> ===============================
> 
> Assume an XML document :
> 
> <?xml version="1.0"?>
> 
> <document>
>   <section name="foo">
>     <p>
>        Hello from section foo
>     </p>
>   </section>
>   <section name="bar">
>     <p>
>        Hello from section bar
>     </p>
>   </section>
> </document>
> 
> Here's a stylesheet for DVSL :
> 
> #match("document")
> <html>
>   <body>
> $context.applyTemplates()
>   </body>
> </html>
> #end
> 
> #match("section")
> <hr>
> <b>Section:</b> $attrib.name
> $context.applyTemplates("p")
> #end
> 
> #match("p")
> <blockquote>
> $node.copy( $node.children() )
> </blockquote>
> #end
> 
> 
> The output would be :
> 
> <html>
>   <body>
> <hr>
> <b>Section:</b> foo
> <blockquote>
> 
>        Hello from section foo
>     
> </blockquote>
> 
> <hr>
> <b>Section:</b> bar
> <blockquote>
> 
>        Hello from section bar
>     
> </blockquote>  
> 
>   </body>
> </html>
> 
> 
> 
> I'd like people that are interested to play with it and give feedback. 
> I would like to see it become a mini-project in Velocity-land (not part
> of the core of course...) so we can nurture it and see where it goes.
> 
> It can replace Anakia right now for documentation rendering if we
> wanted to, but I'm not proposing we do that yet - we need to make sure
> it works. Jason is working on some PDF generation too.
> 
> It's a complete project - just untar.
> 
>   $ant jar
> 
> Will build the jar
> 
>   $ant docs
> 
> Will render the docs (using DVSL, of course) and those docs (1 page in
> /docs) show more examples and cover the API a little bit better.
> 
> You can use it from the command line or from ant, or program something
> yourself.  (Jason is helping me make a DVSL service for Turbine - I
> figured I would contribute to that project sometime :)
> 
> There are a flight of examples in the /examples directory, including
> one that shows how to use a toolbox to make data objects available.
> 
> So give it a look.  Be gentle, as the code is rather prototypeish,
> there needs prollie much more javadoc and such, and I will continue to
> do that, but wanted to get something out for interested people to play
> with.
> 
> Although I note it in the docs, I want to thank Jason, Jon and James
> Strachan :  Jason and Jon for support, enthusiasm and using it, and
> James for displaying tremendous patience when answering my dumb
> questions about XSLT, dom4j and jaxen. Thanks.
> 
> geir
> 
> (Now I can get back to Velocity :)
> 
> -- 
> Geir Magnusson Jr.                                    
> geirm@optonline.net System and Software Consulting
> Be a giant.  Take giant steps.  Do giant things...
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>


-- 
Nick Bauman 
Cortexity Development
Intellectual Process is more important than
Intellectual Property -- you'll see.
http://www.cortexity.com/


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Bojan Smojver <bo...@binarix.com>.
Paulo Gaspar wrote:


> How would it be practical to put such thing on properties?


It wouldn't be. Sorry :-(

Bojan


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/16/01 10:08 PM, "Paulo Gaspar" <pa...@krankikom.de> wrote:

> Answer inline:
> 
>> -----Original Message-----
>> From: Bojan Smojver [mailto:bojan@binarix.com]
>> Sent: Monday, December 17, 2001 3:33 AM
>> 
>> ...
>> 
>> Again, I was just following the XSLT thinking pattern. There is this in
>> XSLT:
>> 
>> -----------------------------------------------------
>> <xsl:strip-space elements="*"/>
>> <xsl:preserve-space elements="text brtext list"/>
>> -----------------------------------------------------
>> 
>> I'm guessing one could define velocity.properties for DVSL which can
>> control that.
> 
> How would it be practical to put such thing on properties?
> 
> I am thinking about THIS bit:
>> <xsl:preserve-space elements="text brtext list"/>
> 
> We could have loads of documents with very different structures and
> processing rules.

Right - it's clearly a stylesheet by stylesheet thing, and you may have
nodes turning it on and off -

#match( "thingy" )

  #set($old = $context.stripSpace( "woogie" ) )
  $context.applyTemplates()
  $context.stripSpace( $old )

#end

It's clear that adding stripSpace() would be a useful addition...

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - Benjamin Franklin



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Paulo Gaspar <pa...@krankikom.de>.
Answer inline:

> -----Original Message-----
> From: Bojan Smojver [mailto:bojan@binarix.com]
> Sent: Monday, December 17, 2001 3:33 AM
> 
> ...
>
> Again, I was just following the XSLT thinking pattern. There is this in 
> XSLT:
> 
> -----------------------------------------------------
> <xsl:strip-space elements="*"/>
> <xsl:preserve-space elements="text brtext list"/>
> -----------------------------------------------------
> 
> I'm guessing one could define velocity.properties for DVSL which can 
> control that.

How would it be practical to put such thing on properties?

I am thinking about THIS bit:
> <xsl:preserve-space elements="text brtext list"/>

We could have loads of documents with very different structures and 
processing rules.

> ...


Have fun,
Paulo Gaspar

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/16/01 10:45 PM, "Bojan Smojver" <bo...@binarix.com> wrote:

> Geir Magnusson Jr. wrote:
> 
> 
>> Aw, come on...  Serious trouble because... It's there.  It is documented. It
>> supports the toolbox.  It's used in the 3 examples included. It's used to
>> generate the documentation.
>> 
>> At least download and untar it...
> 
> 
> Talking of jumping the gun there...
> 

Really.

The upside is that it does verify that it's needed as a feature :)

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - Benjamin Franklin



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Bojan Smojver <bo...@binarix.com>.
Geir Magnusson Jr. wrote:


> Aw, come on...  Serious trouble because... It's there.  It is documented. It
> supports the toolbox.  It's used in the 3 examples included. It's used to
> generate the documentation.
> 
> At least download and untar it...


Talking of jumping the gun there...

Bojan





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/16/01 10:35 PM, "Bojan Smojver" <bo...@binarix.com> wrote:

> Geir Magnusson Jr. wrote:
> 
> 
>> Well, could, if you think its worth it.  It doesn't now.
>> 
>> The idea is that 'global' things are in the $context object (fuzzy what
>> 'global' means, but it's clear here...), and that local node things are in
>> the $node object.  The $attrib object is just notational convenience, and
>> really maps to $node.attrib( key )
> 
> 
> OK. For someone that didn't even try to use DVSL, I'm putting myself
> into a lot of trouble, but 2 main things I see as needed and maybe can
> contribute (don't hold you breath):
> 
> - space smashing

Agreed.

> - Ant task
> 

Aw, come on...  Serious trouble because... It's there.  It is documented. It
supports the toolbox.  It's used in the 3 examples included. It's used to
generate the documentation.

At least download and untar it...

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Bojan Smojver <bo...@binarix.com>.
Geir Magnusson Jr. wrote:


> Well, could, if you think its worth it.  It doesn't now.
> 
> The idea is that 'global' things are in the $context object (fuzzy what
> 'global' means, but it's clear here...), and that local node things are in
> the $node object.  The $attrib object is just notational convenience, and
> really maps to $node.attrib( key )


OK. For someone that didn't even try to use DVSL, I'm putting myself 
into a lot of trouble, but 2 main things I see as needed and maybe can 
contribute (don't hold you breath):

- space smashing
- Ant task

Bojan



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/16/01 10:04 PM, "Bojan Smojver" <bo...@binarix.com> wrote:

> Geir Magnusson Jr. wrote:
> 
> 
>> 
>> Hm.  Well, the $context object is a first class citizen, so to speak, so we
>> could use that as the locus of this kind of information.
>> 
>> I.e.
>> 
>> $context.stripSpace( "*" )
>> $context.preserveSpace( "text foo bar" )
>> 
>> (is that xpath?  "text foo bar"? Why not "text | foo | bar "  ? )
> 
> 
> So, $context is an object that understands stripSpace() and
> preserveSpace() methods.

Well, could, if you think its worth it.  It doesn't now.

The idea is that 'global' things are in the $context object (fuzzy what
'global' means, but it's clear here...), and that local node things are in
the $node object.  The $attrib object is just notational convenience, and
really maps to $node.attrib( key )

>In case of XSLT the list of elements is not
> actually an XPath expression, just a whitespace separated list of
> element names. Making it XPath would have a different (and interesting)
> meaning...

It would also be slower. But indeed, a case where we can build upon XSLT in
ways that make sense...


-- 
Geir Magnusson Jr.                       geirm@optonline.net
System and Software Consulting
You're going to end up getting pissed at your software
anyway, so you might as well not pay for it. Try Open Source.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Bojan Smojver <bo...@binarix.com>.
Geir Magnusson Jr. wrote:


> 
> Hm.  Well, the $context object is a first class citizen, so to speak, so we
> could use that as the locus of this kind of information.
> 
> I.e.
> 
> $context.stripSpace( "*" )
> $context.preserveSpace( "text foo bar" )
> 
> (is that xpath?  "text foo bar"? Why not "text | foo | bar "  ? )


So, $context is an object that understands stripSpace() and 
preserveSpace() methods. In case of XSLT the list of elements is not 
actually an XPath expression, just a whitespace separated list of 
element names. Making it XPath would have a different (and interesting) 
meaning...

Bojan


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/16/01 9:33 PM, "Bojan Smojver" <bo...@binarix.com> wrote:

> Geir Magnusson Jr. wrote:
> 
> 
>> 
>> Yes, if we want.  Currently, there is
>> 
>>   $node.value()
>> 
>> But we can either change it to eat the whitespace by default (I mean,
>> there's no spec to constrain our behavior :), or add another method to the
>> node api, or add (BA DAH!) a tool.  Tools are the new thing here that we
>> should turn to before tinkering with the innards, just like Velocity itself.
> 
> 
> Again, I was just following the XSLT thinking pattern. There is this in
> XSLT:
> 
> -----------------------------------------------------
> <xsl:strip-space elements="*"/>
> <xsl:preserve-space elements="text brtext list"/>
> -----------------------------------------------------
> 
> I'm guessing one could define velocity.properties for DVSL which can
> control that.

Hm.  Well, the $context object is a first class citizen, so to speak, so we
could use that as the locus of this kind of information.

I.e.

$context.stripSpace( "*" )
$context.preserveSpace( "text foo bar" )

(is that xpath?  "text foo bar"? Why not "text | foo | bar "  ? )

> 
> 
>> See how  in both the project docs and the examples/velocitydocs example that
>> a tool is employed - it uses the escaper from Anakia to escape XML entities.
>> I think it's in the "source" template.
> 
> 
> Talking of Anakia, is DVSL a replacement for it, or an addition in your
> view?
> 

I think of it as a replacement or a peer.   I talked to Jon about it, and he
supports that idea.

However, it's not a replacement in the "put it in Velocity core" sense, but
"use in place of".

Some people may like the procedural approach of Anakia, and may not like the
declarative model.

> 
>> I wish I could go faster.  This was all done on my little iBook.  I now wish
>> I took Jon Scott Steven's advice (how many times in my life will I say
>> that...) and gotten the Titanium laptop for the speed and screen size.  I
>> didn¹t' realize how quickly and completely I would take to this little
>> bugger.  OS X is really nice (10.1 - 10.0 was a bit aggravating), and I can
>> do anything and everything here.
> 
> 
> Never laid my hands on any of those. My rule of thumb when it comes to
> computers: "If it doesn't weigh at least 50 kg, it's too small". The
> rule was formed after placing one of the LH series HP servers into the
> top position of a rack (not mine, unfortunatelly). Bloody hard work, but
> worth every drop of sweat...

I'll bet you change your mind when you have to lug one through an airport...

-- 
Geir Magnusson Jr.     geirm@optonline.net
System and Software Consulting
"Whoever would overthrow the liberty of a nation must begin by subduing the
freeness of speech." - Benjamin Franklin



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Bojan Smojver <bo...@binarix.com>.
Geir Magnusson Jr. wrote:


> 
> Yes, if we want.  Currently, there is
> 
>   $node.value()
> 
> But we can either change it to eat the whitespace by default (I mean,
> there's no spec to constrain our behavior :), or add another method to the
> node api, or add (BA DAH!) a tool.  Tools are the new thing here that we
> should turn to before tinkering with the innards, just like Velocity itself.


Again, I was just following the XSLT thinking pattern. There is this in 
XSLT:

-----------------------------------------------------
<xsl:strip-space elements="*"/>
<xsl:preserve-space elements="text brtext list"/>
-----------------------------------------------------

I'm guessing one could define velocity.properties for DVSL which can 
control that.


> See how  in both the project docs and the examples/velocitydocs example that
> a tool is employed - it uses the escaper from Anakia to escape XML entities.
> I think it's in the "source" template.


Talking of Anakia, is DVSL a replacement for it, or an addition in your 
view?


> I wish I could go faster.  This was all done on my little iBook.  I now wish
> I took Jon Scott Steven's advice (how many times in my life will I say
> that...) and gotten the Titanium laptop for the speed and screen size.  I
> didn¹t' realize how quickly and completely I would take to this little
> bugger.  OS X is really nice (10.1 - 10.0 was a bit aggravating), and I can
> do anything and everything here.


Never laid my hands on any of those. My rule of thumb when it comes to 
computers: "If it doesn't weigh at least 50 kg, it's too small". The 
rule was formed after placing one of the LH series HP servers into the 
top position of a rack (not mine, unfortunatelly). Bloody hard work, but 
worth every drop of sweat...

Bojan


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/16/01 8:19 PM, "Bojan Smojver" <bo...@binarix.com> wrote:

> Geir Magnusson Jr. wrote:
> 
> 
>> 
>> Hm. I'm not sure the natural way to phrase it.  You can use #set() in any
>> way you want and you can grab outside documents using Xpath.  I.e. You
>> should be able to do something like
>> 
>>    #set( $thingy = $context.selectNodes( "document('menu.xml')/menu" ) )
>>    
>> Or
>> 
>>    $context.applyTemplates( "document('menu.xml')/menu" )
>> 
>> But I have to confess I don't clearly get what you are trying to do above.
> 
> 
> I've rolled two examples of XLST features into one call (sorry about the
> confusion):
> 
> - external document (obviously covered)

Yep, through xpath.

> - passing parameters to templates (probably done via a #set in DVSL); my
> understanding is that #set defines a reference for the whole context
> while the parameters of XSLT are a very local phenomenon (I'm guessing
> similar to parameters of Velocity macros)

Yes - the context is valid throughout a single transformation (i.e. 1 input
document), so templates can 'talk' to each other.
 
> 
>> Doesn't that bring us part of the way back to XSLT? :)
>> 
>> I actually thought of that, to be frank, but didn't understand then the
>> point of the exercise...
> 
> 
> One can have a stylesheet processing other stylesheets. For instance,
> you design a stylesheet with certain functionality and then run it
> through transformation which gives it a slightly different kind of
> functionality without human intervention (almost).
> 

Right

> 
>>> 5. Is there an equivalent for '<xsl:attribute name="target">...' and
>>> '<xsl:element name="{$heading}"
>>> namespace="http://www.w3.org/1999/xhtml">..' stuff?
>>> 
>>> 
>> 
>> If I understand attribute correctly, not as such.
>> 
>> Note that I don't have tremendous amount of XSLT experience.
>> 
>> However I think that we have a richer toolkit to workwith than you do in
>> XSLT, so a lot of these contructs can just be handled.
>> 
>> For example, the <xsl:attribute ...> example from the Michael Kay book :
>> 
>> <table>
>>   <xsl:attribute border="2" />
>>    ....
>> </table>
>> 
>> Now, why do this?  I mean how about
>> 
>> <table border="2">
>> ....
>> </table>
>> 
>> Or
>> 
>> <table>
>>    <xsl:call-template name="set-border" />
>> </table>
>> 
>> Could be (when I get the #name() directive in there )
>> 
>> <table $context.callTemplate("set-border") >
>> ...
>> </table>
>> 
>> Or use a VM
>> 
>> <table #setBorder( $node ) >
>> ...
>> </table>
>> 
>> I *know* it's not the same thing - that the first example doesn't express
>> the same functionality that the elegant <xsl:attribute> can achive, but I
>> wonder if this is the tail wagging the dog?
> 
> 
> The usual thing in XSLT is:
> 
> -------------------
> <table
>  <xsl:if test="boolean(@border)">
>    <xsl:attribute name="border"><xsl:value-of
>                   select="@border"/></xsl:attribute>
>  </xsl:if>
> </table>
> ------------------
> 
> so the attribute only exists if something else happened (in this case
> the attribute of the matching element) and applies to the enclosing
> element. That's pretty nifty for generating XML/HTML, but is rather
> useless for other types of output.
> 
> I guess one would do something like this in DVSL to achieve the same:
> 
> ------------------
> <table #if($attrib.border) border="$attrib.border" #end>
>  ...
> </table>
> 
> ------------------

Yep, or we can add  $context.test( xpathexpression ) as well to support this
more naturally

> 
> 
> ------------------
> SIDENOTE: Question for everyone NOT using Velocity yet:
> 
> Which syntax from the above 2 examples do you find easier?
> ------------------

LOL
 
> The only 'advantage' of XSLT here would be that the <xsl:attribute> can
> appear anywhere within the element. I guess the other benefits (e.g.
> Velocity based :-) of DVSL would probably outweigh that.

I dunno - that is what we have to figure out.  XSLT is *very* powerful, and
very impressive technically (as part of doing this, I found a bug in dom4j
which was an issue in Jaxen, so I was trying to solve it and will continue
to work on Jaxen as long as that community can tolerate me :)
 
> You've probably noticed already that I'm a very selfish bastard and the
> questions I asked were not made up but rather cut and paste from XSLT
> stuff I use daily. I just wanted to know if DVSL can be plugged in... ;-)

That's why I put it out there - this will only be useful if it solve real
problems for real people.  Kinda like beef.  (Sorry- couldn't resist)

If this doesn't work for people who use XSLT regularly, or we can't
iteratively improve, then we has to reposition it as a lightweight XML
processing tool, or chuck it and make Jason use XSLT again :)

The hope is that it can solve many problems currently solved by XSLT, and to
do that we of course add to the API, but also offer a 'rogues gallery' of
pattern mappings from how you do something in XSLT to the solution in DVSL.

> 
> Oh, and one final DVSL question: will there be something along the lines
> of 'text normalisation' for text nodes? It really makes HTML/XHTML pages
> much smaller (i.e. it blows away all the redundant whitespace fluff).

Yes, if we want.  Currently, there is

  $node.value()

But we can either change it to eat the whitespace by default (I mean,
there's no spec to constrain our behavior :), or add another method to the
node api, or add (BA DAH!) a tool.  Tools are the new thing here that we
should turn to before tinkering with the innards, just like Velocity itself.

See how  in both the project docs and the examples/velocitydocs example that
a tool is employed - it uses the escaper from Anakia to escape XML entities.
I think it's in the "source" template.

> A personal question: Geir, do you program at the speed of light or
> faster ;-)

I wish I could go faster.  This was all done on my little iBook.  I now wish
I took Jon Scott Steven's advice (how many times in my life will I say
that...) and gotten the Titanium laptop for the speed and screen size.  I
didn¹t' realize how quickly and completely I would take to this little
bugger.  OS X is really nice (10.1 - 10.0 was a bit aggravating), and I can
do anything and everything here.

Thanks for the kind words :)

geir

-- 
Geir Magnusson Jr.                       geirm@optonline.net
System and Software Consulting
You're going to end up getting pissed at your software
anyway, so you might as well not pay for it. Try Open Source.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Bojan Smojver <bo...@binarix.com>.
Geir Magnusson Jr. wrote:


> 
> Hm. I'm not sure the natural way to phrase it.  You can use #set() in any
> way you want and you can grab outside documents using Xpath.  I.e. You
> should be able to do something like
> 
>    #set( $thingy = $context.selectNodes( "document('menu.xml')/menu" ) )
>    
> Or
> 
>    $context.applyTemplates( "document('menu.xml')/menu" )
> 
> But I have to confess I don't clearly get what you are trying to do above.


I've rolled two examples of XLST features into one call (sorry about the 
confusion):

- external document (obviously covered)
- passing parameters to templates (probably done via a #set in DVSL); my 
understanding is that #set defines a reference for the whole context 
while the parameters of XSLT are a very local phenomenon (I'm guessing 
similar to parameters of Velocity macros)


> Doesn't that bring us part of the way back to XSLT? :)
> 
> I actually thought of that, to be frank, but didn't understand then the
> point of the exercise...


One can have a stylesheet processing other stylesheets. For instance, 
you design a stylesheet with certain functionality and then run it 
through transformation which gives it a slightly different kind of 
functionality without human intervention (almost).


>>5. Is there an equivalent for '<xsl:attribute name="target">...' and
>>'<xsl:element name="{$heading}"
>>namespace="http://www.w3.org/1999/xhtml">..' stuff?
>>
>>
> 
> If I understand attribute correctly, not as such.
> 
> Note that I don't have tremendous amount of XSLT experience.
> 
> However I think that we have a richer toolkit to workwith than you do in
> XSLT, so a lot of these contructs can just be handled.
> 
> For example, the <xsl:attribute ...> example from the Michael Kay book :
> 
> <table>
>   <xsl:attribute border="2" />
>    ....
> </table>
> 
> Now, why do this?  I mean how about
> 
> <table border="2">
> ....
> </table>
> 
> Or
> 
> <table>
>    <xsl:call-template name="set-border" />
> </table>
> 
> Could be (when I get the #name() directive in there )
> 
> <table $context.callTemplate("set-border") >
> ...
> </table>
> 
> Or use a VM
> 
> <table #setBorder( $node ) >
> ...
> </table>
> 
> I *know* it's not the same thing - that the first example doesn't express
> the same functionality that the elegant <xsl:attribute> can achive, but I
> wonder if this is the tail wagging the dog?


The usual thing in XSLT is:

-------------------
<table
   <xsl:if test="boolean(@border)">
     <xsl:attribute name="border"><xsl:value-of
                    select="@border"/></xsl:attribute>
   </xsl:if>
</table>
------------------

so the attribute only exists if something else happened (in this case 
the attribute of the matching element) and applies to the enclosing 
element. That's pretty nifty for generating XML/HTML, but is rather 
useless for other types of output.

I guess one would do something like this in DVSL to achieve the same:

------------------
<table #if($attrib.border) border="$attrib.border" #end>
   ...
</table>

------------------


------------------
SIDENOTE: Question for everyone NOT using Velocity yet:

Which syntax from the above 2 examples do you find easier?
------------------

The only 'advantage' of XSLT here would be that the <xsl:attribute> can 
appear anywhere within the element. I guess the other benefits (e.g. 
Velocity based :-) of DVSL would probably outweigh that.

You've probably noticed already that I'm a very selfish bastard and the 
questions I asked were not made up but rather cut and paste from XSLT 
stuff I use daily. I just wanted to know if DVSL can be plugged in... ;-)

Oh, and one final DVSL question: will there be something along the lines 
of 'text normalisation' for text nodes? It really makes HTML/XHTML pages 
much smaller (i.e. it blows away all the redundant whitespace fluff).

A personal question: Geir, do you program at the speed of light or 
faster ;-)


Bojan


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/16/01 6:58 PM, "Bojan Smojver" <bo...@binarix.com> wrote:

> This is very interesting... I might give it a go as a replacement for
> XSLT. Although XSLT is very useful and feature full, the syntax is
> horrendous :-(
> 
> A few questions:
> 
> 1. Can you pass arguments around? Something like:
> 
> ------------------
> <xsl:template match="menu">
>  <xsl:param name="page-loc"/>
>  <xsl:param name="page-type"/>
> ...
> ------------------
> 
> and then the call (notice the outside XML file):
> 
> ------------------
> <xsl:apply-templates select="document('menu.xml')/menu">
>  <xsl:with-param name="page-loc"  select="$page-loc"/>
>  <xsl:with-param name="page-type" select="$page-type"/>
> </xsl:apply-templates>
> ------------------

Hm. I'm not sure the natural way to phrase it.  You can use #set() in any
way you want and you can grab outside documents using Xpath.  I.e. You
should be able to do something like

   #set( $thingy = $context.selectNodes( "document('menu.xml')/menu" ) )
   
Or

   $context.applyTemplates( "document('menu.xml')/menu" )

But I have to confess I don't clearly get what you are trying to do above.


> 
> 2. I'm guessing that it's allowed to define normal Velocity context
> references with #set($ref="Value"). That's one of the royal pains in the
> back side with XSLT - variable handling is poor (to put it mildly).
> 

Yes.  That's one of the benefits.

> 3. It is recursive, like XSLT, right?

Yes
 
> 4. Any plans to make the stylesheet an XML document as well? It is
> sometimes useful to transform the stylesheet itself...

Doesn't that bring us part of the way back to XSLT? :)

I actually thought of that, to be frank, but didn't understand then the
point of the exercise...
 
> 5. Is there an equivalent for '<xsl:attribute name="target">...' and
> '<xsl:element name="{$heading}"
> namespace="http://www.w3.org/1999/xhtml">..' stuff?
> 

If I understand attribute correctly, not as such.

Note that I don't have tremendous amount of XSLT experience.

However I think that we have a richer toolkit to workwith than you do in
XSLT, so a lot of these contructs can just be handled.

For example, the <xsl:attribute ...> example from the Michael Kay book :

<table>
  <xsl:attribute border="2" />
   ....
</table>

Now, why do this?  I mean how about

<table border="2">
....
</table>

Or

<table>
   <xsl:call-template name="set-border" />
</table>

Could be (when I get the #name() directive in there )

<table $context.callTemplate("set-border") >
...
</table>

Or use a VM

<table #setBorder( $node ) >
...
</table>

I *know* it's not the same thing - that the first example doesn't express
the same functionality that the elegant <xsl:attribute> can achive, but I
wonder if this is the tail wagging the dog?

(And it's things like this why I didn't want to put in CVS at first, but
just have a community discussion around the tgz...)


My point of view in doing  this was that we can take from XSLT what we want,
and we can leave behind and innovate where we want (or need to...)


As for <xsl:element, that's screaming for a  tool, but again, the dissonance
between the declarative model and the chance for a procedural model ( using
VMs, #foreach() ) means we might need to rethink some things.

DVSL has no concept of 'element' in the output, the way XSLT has....

Geir

-- 
Geir Magnusson Jr.                       geirm@optonline.net
System and Software Consulting
You're going to end up getting pissed at your software
anyway, so you might as well not pay for it. Try Open Source.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Bojan Smojver <bo...@binarix.com>.
This is very interesting... I might give it a go as a replacement for 
XSLT. Although XSLT is very useful and feature full, the syntax is 
horrendous :-(

A few questions:

1. Can you pass arguments around? Something like:

------------------
<xsl:template match="menu">
   <xsl:param name="page-loc"/>
   <xsl:param name="page-type"/>
...
------------------

and then the call (notice the outside XML file):

------------------
<xsl:apply-templates select="document('menu.xml')/menu">
   <xsl:with-param name="page-loc"  select="$page-loc"/>
   <xsl:with-param name="page-type" select="$page-type"/>
</xsl:apply-templates>
------------------

2. I'm guessing that it's allowed to define normal Velocity context 
references with #set($ref="Value"). That's one of the royal pains in the 
  back side with XSLT - variable handling is poor (to put it mildly).

3. It is recursive, like XSLT, right?

4. Any plans to make the stylesheet an XML document as well? It is 
sometimes useful to transform the stylesheet itself...

5. Is there an equivalent for '<xsl:attribute name="target">...' and 
'<xsl:element name="{$heading}" 
namespace="http://www.w3.org/1999/xhtml">..' stuff?

Bojan


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/16/01 9:44 PM, "Bojan Smojver" <bo...@binarix.com> wrote:

> Geir Magnusson Jr. wrote:
> 
> 
>> Again, I appreciate the sentiment - I mean, I'll admit I like being
>> appreciated, but really - I didn't invent Velocity, I didn¹t start the
>> project, I didn't invent the concept...  You find the same kind of support
>> all around Jakarta - look at Jason in Turbine-land, for example.
> 
> 
> I think that all those guys are legends too. That doesn't mean you
> aren't. Face it - being a celebrity comes at a price. People start
> calling you legend, they recognize you on the mailing lists etc. You've
> crossed the line, it's all over...
> 
> You see, I'm running a business that uses open source software like
> Linux, Apache, Tomcat, Velocity etc. The only 'pay' I can give to all
> the people that work on those projects is to say an occasional 'Thank
> you'. And it's also good for sucking up in case I need help ;-)
> 

That's great then.  I appreciate it. :)

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Bojan Smojver <bo...@binarix.com>.
Geir Magnusson Jr. wrote:

 
> Again, I appreciate the sentiment - I mean, I'll admit I like being
> appreciated, but really - I didn't invent Velocity, I didn¹t start the
> project, I didn't invent the concept...  You find the same kind of support
> all around Jakarta - look at Jason in Turbine-land, for example.


I think that all those guys are legends too. That doesn't mean you 
aren't. Face it - being a celebrity comes at a price. People start 
calling you legend, they recognize you on the mailing lists etc. You've 
crossed the line, it's all over...

You see, I'm running a business that uses open source software like 
Linux, Apache, Tomcat, Velocity etc. The only 'pay' I can give to all 
the people that work on those projects is to say an occasional 'Thank 
you'. And it's also good for sucking up in case I need help ;-)

Bojan


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Paulo Gaspar <pa...@krankikom.de>.
> My theory is "paranoid obsessive-compulsive manic-depressive with tolerant
> spouse"

I would say "tolerant like a saint".
=;o)

Have fun,
Paulo


> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Monday, December 17, 2001 3:52 AM
> To: velocity-user@jakarta.apache.org
> Subject: Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)
>
>
> On 12/16/01 10:01 PM, "Paulo Gaspar" <pa...@krankikom.de> wrote:
>
> > Sometimes I ask myself "how can he do that?". There was a time I
> > developed a theory about you having financial support from an
> > anti-XSLT or anti-JSP coalition... and of course that I would like
> > to contribute to such a cause (hehehe).
> >
>
> My theory is "paranoid obsessive-compulsive manic-depressive with tolerant
> spouse"
>
> --
> Geir Magnusson Jr.                                     geirm@optonline.net
> System and Software Consulting
> Be a giant.  Take giant steps.  Do giant things...
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/16/01 10:01 PM, "Paulo Gaspar" <pa...@krankikom.de> wrote:

> Sometimes I ask myself "how can he do that?". There was a time I
> developed a theory about you having financial support from an
> anti-XSLT or anti-JSP coalition... and of course that I would like
> to contribute to such a cause (hehehe).
> 

My theory is "paranoid obsessive-compulsive manic-depressive with tolerant
spouse"

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Paulo Gaspar <pa...@krankikom.de>.
Answer inline:

> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Monday, December 17, 2001 3:17 AM
>
>
> On 12/16/01 9:13 PM, "Bojan Smojver" <bo...@binarix.com> wrote:
>
> > Geir Magnusson Jr. wrote:
> >
> >> Thanks, but no. Please. There are legends all around Apache and I am
> >> certainly, definitely not one of them.

I am not so sure too...

> ...
>
> > I dare you to find on Velocity list a user question that you didn't have
> > a constructive answer for. And if only I had time to produce a chart
> > of CVS commit delays as the results of user requested fixes,
> > documentation changes etc. in Velocity - I think many paid support
> > offers wouldn't come close in response times.

It is damn true!

> > If I was a Velocity committer, I'd propose a vote along the lines:
> >
-----------------------------------------------------
Please vote to make Geir an Official Velocity Legend (OVL) TM:

[X] +1: Geir is a Legend
[ ] +0: Geir is a Legend but I'm unable to support it
[ ] -0: Geir is not a Legend but I have no objections to him being one
[ ] -1: Geir is not a Legend

-----------------------------------------------------


> Again, I appreciate the sentiment - I mean, I'll admit I like being
> appreciated, but really - I didn't invent Velocity, I didn¹t start the
> project, I didn't invent the concept...

Sure, but look at its evolution during 2001!!!

Lets see, my Outlook thing is still keeping all (I hope) cvs messages
since March 7 of this year. Geir is the author of:
  809 entries in 1193!!!

Jon follows with 179 and all the other are under 100!


> You find the same kind of support
> all around Jakarta - look at Jason in Turbine-land, for example.

All around Jakarta?
LOL

I mean, there is generally good support around Jakarta, but nothing so
instantaneous and complete and well humored.
(I remembered this last one after seeing Jon's name bellow. (o;= )

Sometimes I ask myself "how can he do that?". There was a time I
developed a theory about you having financial support from an
anti-XSLT or anti-JSP coalition... and of course that I would like
to contribute to such a cause (hehehe).


> I'm just glad y'all haven't told me to shut up yet :)
>
> Look at Roy Fielding, Brian Behlendorf, Jon Stevens, Craig
> McClanahan, Ceki
> Gulku, etc...  I would add Sam Ruby, but there's too much XSLT in Gump :)

Yes, when I tried Gump (it is so f*cking slow and complex) I felt the
temptation of converting all that stuff to Velocity. Maybe the
intermediate stages of such conversion get easier with DVSL...

Actually, I admire Sam for putting up with so much XSLT and being able
to make the damn thing work!


> These are people who really made a difference... (and theres many more for
> that list)

Yes, like Geir Magnusson, of course.
=:o)

You are "just" following your motto:

> Be a giant.  Take giant steps.  Do giant things...


Now, if you keep denying, I will start thinking you want us to keep
insisting!!!
=;o)

(If it is so, you must wait because I must go and have some sleep!
hehehe)


Have fun,
Paulo


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/16/01 9:13 PM, "Bojan Smojver" <bo...@binarix.com> wrote:

> Geir Magnusson Jr. wrote:
> 
> 
>> Thanks, but no. Please. There are legends all around Apache and I am
>> certainly, definitely not one of them.
> 
> 
> Now you're heading for a real flame war...

I love a good debate...  As a consultant in a faltering IT economy, I have
free time now and again :)
 
> I dare you to find on Velocity list a user question that you didn't have
> a constructive answer for. And if only I had time to produce a chart
> of CVS commit delays as the results of user requested fixes,
> documentation changes etc. in Velocity - I think many paid support
> offers wouldn't come close in response times.
> 
> If I was a Velocity committer, I'd propose a vote along the lines:
> 
> -----------------------------------------------------
> Please vote to make Geir an Official Velocity Legend (OVL) TM:
> 
> [ ] +1: Geir is a Legend
> [ ] +0: Geir is a Legend but I'm unable to support it
> [ ] -0: Geir is not a Legend but I have no objections to him being one
> [X] -1: Geir is not a Legend
> 
> -----------------------------------------------------


Again, I appreciate the sentiment - I mean, I'll admit I like being
appreciated, but really - I didn't invent Velocity, I didn¹t start the
project, I didn't invent the concept...  You find the same kind of support
all around Jakarta - look at Jason in Turbine-land, for example.

I'm just glad y'all haven't told me to shut up yet :)

Look at Roy Fielding, Brian Behlendorf, Jon Stevens, Craig McClanahan, Ceki
Gulku, etc...  I would add Sam Ruby, but there's too much XSLT in Gump :)

These are people who really made a difference... (and theres many more for
that list)


-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Jason van Zyl <jv...@zenplex.com>.
On 12/16/01 9:13 PM, "Bojan Smojver" <bo...@binarix.com> wrote:

> Geir Magnusson Jr. wrote:
> 
> 
>> Thanks, but no. Please. There are legends all around Apache and I am
>> certainly, definitely not one of them.
> 
> 
> Now you're heading for a real flame war...
> 
> I dare you to find on Velocity list a user question that you didn't have
> a constructive answer for. And if only I had time to produce a chart
> of CVS commit delays as the results of user requested fixes,
> documentation changes etc. in Velocity - I think many paid support
> offers wouldn't come close in response times.
> 
> If I was a Velocity committer, I'd propose a vote along the lines:
> 
> -----------------------------------------------------
> Please vote to make Geir an Official Velocity Legend (OVL) TM:
> 
> [X] +10: Geir is a Legend
> [ ] +0: Geir is a Legend but I'm unable to support it
> [ ] -0: Geir is not a Legend but I have no objections to him being one
> [ ] -1: Geir is not a Legend
> 
> -----------------------------------------------------

I am also still elated that I don't have to look at xslt any more! Did I say
that already ;-)

-- 

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Bojan Smojver <bo...@binarix.com>.
Geir Magnusson Jr. wrote:


> Thanks, but no. Please. There are legends all around Apache and I am
> certainly, definitely not one of them.


Now you're heading for a real flame war...

I dare you to find on Velocity list a user question that you didn't have 
  a constructive answer for. And if only I had time to produce a chart 
of CVS commit delays as the results of user requested fixes, 
documentation changes etc. in Velocity - I think many paid support 
offers wouldn't come close in response times.

If I was a Velocity committer, I'd propose a vote along the lines:

-----------------------------------------------------
Please vote to make Geir an Official Velocity Legend (OVL) TM:

[ ] +1: Geir is a Legend
[ ] +0: Geir is a Legend but I'm unable to support it
[ ] -0: Geir is not a Legend but I have no objections to him being one
[ ] -1: Geir is not a Legend

-----------------------------------------------------


:-))

Bojan




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/16/01 8:39 PM, "Bojan Smojver" <bo...@binarix.com> wrote:

> Paulo Gaspar wrote:
> 
> 
>> (Man, the XSLT freaks are going to start hating you one of these days!)
> 
> 
> Not really being a true freak (just a user), I'd say we're going to love
> him! He's making our life easier :-)

If it works!  That's the key thing we have to find out.  For simple cases,
it seems to work like a champ.  But you yourself brought out some great
examples of things that we don't have an direct answer for....

> 
> In case I forgot to do that before: THANKS GEIR, YOU'RE A LEGEND!
> 

Thanks, but no. Please. There are legends all around Apache and I am
certainly, definitely not one of them.

This was fun, and a sum of my experiences here in Velocity land.

What got this going was thought-work for a client, but you can also map it
back somewhat to Anakia, as we were trying to make it recursive as well off
and on.  I wanted to make sure I mentioned that...

-- 
Geir Magnusson Jr.                       geirm@optonline.net
System and Software Consulting
You're going to end up getting pissed at your software
anyway, so you might as well not pay for it. Try Open Source.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Bojan Smojver <bo...@binarix.com>.
Paulo Gaspar wrote:


> (Man, the XSLT freaks are going to start hating you one of these days!)


Not really being a true freak (just a user), I'd say we're going to love 
him! He's making our life easier :-)

In case I forgot to do that before: THANKS GEIR, YOU'RE A LEGEND!

Bojan


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Bojan Smojver <bo...@binarix.com>.
Geir Magnusson Jr. wrote:


> Lets iterate some improvements in first.  Bojan has raised some troubling
> points...


Nah, I'm just being my usual bitchy self. I think that most of the stuff 
that I mentioned you actually answered in your e-mail.

Bojan


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/16/01 9:12 PM, "Paulo Gaspar" <pa...@krankikom.de> wrote:

>> -----Original Message-----
>> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
>> Sent: Monday, December 17, 2001 2:40 AM
>> 
>> Lets iterate some improvements in first.  Bojan has raised some troubling
>> points...
>> 
> 
> Hey man, for something that still isn't on CVS it already does a lot.
> 
> It looks like a really big kick start. Now we can play with it and it will
> smooth. When it gets to version 1.0 it will already be a killer.
> 
> BTW, that is why you were getting interested on custom directives, huh?
> =;o)
> 

No :)  That happened long before I started this.

The custom directive came about because I was first trying with VMs, but
that didn't work for all sorts of reasons, including the fact that I didn't
want your stylesheet to collide with a VM library you might be using...

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Paulo Gaspar <pa...@krankikom.de>.
> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Monday, December 17, 2001 2:40 AM
> 
> Lets iterate some improvements in first.  Bojan has raised some troubling
> points...
> 

Hey man, for something that still isn't on CVS it already does a lot.

It looks like a really big kick start. Now we can play with it and it will
smooth. When it gets to version 1.0 it will already be a killer.

BTW, that is why you were getting interested on custom directives, huh?
=;o)


Have fun,
Paulo Gaspar

http://www.krankikom.de
http://www.ruhronline.de
 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/16/01 8:37 PM, "Paulo Gaspar" <pa...@krankikom.de> wrote:

> I am, of course, an adept already.
> 
> And now I have to go back to the 2 lists where I posted that XSLT was
> only better than Velocity with semi-structured data and tell them
> about the new thruth!
> =:o)

:)

Lets iterate some improvements in first.  Bojan has raised some troubling
points...

> 
> (Man, the XSLT freaks are going to start hating you one of these days!)
> 

XSLT is a standard.  That alone will keep the True Believers there...


The rest of us won't need as much ibuprofin.

> Thanks a lot Geir,
> Paulo Gaspar
> 
> http://www.krankikom.de
> http://www.ruhronline.de

:)
 
> 
> 
>> -----Original Message-----
>> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
>> Sent: Sunday, December 16, 2001 9:05 PM
>> To: velocity-user@jakarta.apache.org
>> Subject: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)
>> 
>> 
>> 
>> I put into the whiteboard/geirm directory in CVS a .tgz containing a
>> Velocity-based tool called 'DVSL'.
>> 
>> DVSL is n XSLT-like XML transformation tool.
>> 
>> It is XSLT-like because  stylesheets are declarative in
>> structure, defining
>> 'output templates' for a given Xpath matching rule.
>> 
>> The good features :
>> 
>> - It uses Velocity as the template language
>> 
>> - It uses Xpath for node selection for template processing and navigation
>> 
>> - The stylesheet structure is almost identical to that of XSLT.
>> 
>> - Because it uses Velocity, binding to Java objects is trivial
>> 
>> In fact, the last point was the motivator - I have a client or
>> two that use
>> XSLT to content generation in a Java server environment, and they
>> are always
>> struggling to integrate other data sources in the processing.
>> 
>> Regarding the stylesheet, there is what seems so far to be a 100%
>> Anakia vsl
>> compatible stylesheet for transforming existing Jakarta XML documentation
>> (there is a Velocity doc conversion example in the project in \examples).
>> This stylesheet was created by copying Craig's xsl version of the
>> Anakia vsl
>> and just replacing the pointy bracket stuff with Velocity.  Same
>> structure,
>> same xpath expressions.
>> 
>> 
>> What does a template look like?
>> ===============================
>> 
>> Assume an XML document :
>> 
>> <?xml version="1.0"?>
>> 
>> <document>
>>   <section name="foo">
>>     <p>
>>        Hello from section foo
>>     </p>
>>   </section>
>>   <section name="bar">
>>     <p>
>>        Hello from section bar
>>     </p>
>>   </section>
>> </document>
>> 
>> Here's a stylesheet for DVSL :
>> 
>> #match("document")
>> <html>
>>   <body>
>> $context.applyTemplates()
>>   </body>
>> </html>
>> #end
>> 
>> #match("section")
>> <hr>
>> <b>Section:</b> $attrib.name
>> $context.applyTemplates("p")
>> #end
>> 
>> #match("p")
>> <blockquote>
>> $node.copy( $node.children() )
>> </blockquote>
>> #end
>> 
>> 
>> The output would be :
>> 
>> <html>
>>   <body>
>> <hr>
>> <b>Section:</b> foo
>> <blockquote>
>> 
>>        Hello from section foo
>> 
>> </blockquote>
>> 
>> <hr>
>> <b>Section:</b> bar
>> <blockquote>
>> 
>>        Hello from section bar
>> 
>> </blockquote>
>> 
>>   </body>
>> </html>
>> 
>> 
>> 
>> I'd like people that are interested to play with it and give feedback.  I
>> would like to see it become a mini-project in Velocity-land (not
>> part of the
>> core of course...) so we can nurture it and see where it goes.
>> 
>> It can replace Anakia right now for documentation rendering if we
>> wanted to,
>> but I'm not proposing we do that yet - we need to make sure it works.
>> Jason is working on some PDF generation too.
>> 
>> It's a complete project - just untar.
>> 
>>   $ant jar
>> 
>> Will build the jar
>> 
>>   $ant docs
>> 
>> Will render the docs (using DVSL, of course) and those docs (1 page in
>> /docs) show more examples and cover the API a little bit better.
>> 
>> You can use it from the command line or from ant, or program something
>> yourself.  (Jason is helping me make a DVSL service for Turbine -
>> I figured
>> I would contribute to that project sometime :)
>> 
>> There are a flight of examples in the /examples directory, including one
>> that shows how to use a toolbox to make data objects available.
>> 
>> So give it a look.  Be gentle, as the code is rather prototypeish, there
>> needs prollie much more javadoc and such, and I will continue to do that,
>> but wanted to get something out for interested people to play with.
>> 
>> Although I note it in the docs, I want to thank Jason, Jon and James
>> Strachan :  Jason and Jon for support, enthusiasm and using it, and James
>> for displaying tremendous patience when answering my dumb questions about
>> XSLT, dom4j and jaxen. Thanks.
>> 
>> geir
>> 
>> (Now I can get back to Velocity :)
>> 
>> --
>> Geir Magnusson Jr.                                     geirm@optonline.net
>> System and Software Consulting
>> Be a giant.  Take giant steps.  Do giant things...
>> 
>> 
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>> 
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - Benjamin Franklin



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Paulo Gaspar <pa...@krankikom.de>.
I am, of course, an adept already.

And now I have to go back to the 2 lists where I posted that XSLT was
only better than Velocity with semi-structured data and tell them
about the new thruth!
=:o)

(Man, the XSLT freaks are going to start hating you one of these days!)


Thanks a lot Geir,
Paulo Gaspar

http://www.krankikom.de
http://www.ruhronline.de



> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Sunday, December 16, 2001 9:05 PM
> To: velocity-user@jakarta.apache.org
> Subject: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)
>
>
>
> I put into the whiteboard/geirm directory in CVS a .tgz containing a
> Velocity-based tool called 'DVSL'.
>
> DVSL is n XSLT-like XML transformation tool.
>
> It is XSLT-like because  stylesheets are declarative in
> structure, defining
> 'output templates' for a given Xpath matching rule.
>
> The good features :
>
> - It uses Velocity as the template language
>
> - It uses Xpath for node selection for template processing and navigation
>
> - The stylesheet structure is almost identical to that of XSLT.
>
> - Because it uses Velocity, binding to Java objects is trivial
>
> In fact, the last point was the motivator - I have a client or
> two that use
> XSLT to content generation in a Java server environment, and they
> are always
> struggling to integrate other data sources in the processing.
>
> Regarding the stylesheet, there is what seems so far to be a 100%
> Anakia vsl
> compatible stylesheet for transforming existing Jakarta XML documentation
> (there is a Velocity doc conversion example in the project in \examples).
> This stylesheet was created by copying Craig's xsl version of the
> Anakia vsl
> and just replacing the pointy bracket stuff with Velocity.  Same
> structure,
> same xpath expressions.
>
>
> What does a template look like?
> ===============================
>
> Assume an XML document :
>
> <?xml version="1.0"?>
>
> <document>
>   <section name="foo">
>     <p>
>        Hello from section foo
>     </p>
>   </section>
>   <section name="bar">
>     <p>
>        Hello from section bar
>     </p>
>   </section>
> </document>
>
> Here's a stylesheet for DVSL :
>
> #match("document")
> <html>
>   <body>
> $context.applyTemplates()
>   </body>
> </html>
> #end
>
> #match("section")
> <hr>
> <b>Section:</b> $attrib.name
> $context.applyTemplates("p")
> #end
>
> #match("p")
> <blockquote>
> $node.copy( $node.children() )
> </blockquote>
> #end
>
>
> The output would be :
>
> <html>
>   <body>
> <hr>
> <b>Section:</b> foo
> <blockquote>
>
>        Hello from section foo
>
> </blockquote>
>
> <hr>
> <b>Section:</b> bar
> <blockquote>
>
>        Hello from section bar
>
> </blockquote>
>
>   </body>
> </html>
>
>
>
> I'd like people that are interested to play with it and give feedback.  I
> would like to see it become a mini-project in Velocity-land (not
> part of the
> core of course...) so we can nurture it and see where it goes.
>
> It can replace Anakia right now for documentation rendering if we
> wanted to,
> but I'm not proposing we do that yet - we need to make sure it works.
> Jason is working on some PDF generation too.
>
> It's a complete project - just untar.
>
>   $ant jar
>
> Will build the jar
>
>   $ant docs
>
> Will render the docs (using DVSL, of course) and those docs (1 page in
> /docs) show more examples and cover the API a little bit better.
>
> You can use it from the command line or from ant, or program something
> yourself.  (Jason is helping me make a DVSL service for Turbine -
> I figured
> I would contribute to that project sometime :)
>
> There are a flight of examples in the /examples directory, including one
> that shows how to use a toolbox to make data objects available.
>
> So give it a look.  Be gentle, as the code is rather prototypeish, there
> needs prollie much more javadoc and such, and I will continue to do that,
> but wanted to get something out for interested people to play with.
>
> Although I note it in the docs, I want to thank Jason, Jon and James
> Strachan :  Jason and Jon for support, enthusiasm and using it, and James
> for displaying tremendous patience when answering my dumb questions about
> XSLT, dom4j and jaxen. Thanks.
>
> geir
>
> (Now I can get back to Velocity :)
>
> --
> Geir Magnusson Jr.                                     geirm@optonline.net
> System and Software Consulting
> Be a giant.  Take giant steps.  Do giant things...
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANNOUNCE] DVSL (Declarative Velocity Stylesheet Language)

Posted by Jason van Zyl <jv...@zenplex.com>.
On 12/16/01 3:05 PM, "Geir Magnusson Jr." <ge...@optonline.net> wrote:

> 
> I put into the whiteboard/geirm directory in CVS a .tgz containing a
> Velocity-based tool called 'DVSL'.
> 
> DVSL is n XSLT-like XML transformation tool.

Woo hoo! I never have to look at xslt ever again in my life! The pain and
suffering in the world has been reduced an order of magnitude :-)

Geir you rock!

-- 

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>