You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Paul Libbrecht <pa...@dfki.de> on 2003/01/17 17:50:37 UTC

[jelly] value-of ??

	
Jellyers,

I seem to be missing an element that does the following: I have an xml 
parsed into a variable using, eg, xml:parse. Now I'd like to address 
this to the xml:transform element... without outputting it, of course !

How can I do such a thing ??
Is there something like "<core:execVar name="varName"/> which could be 
a child of xml:transform ??

Thanks.

Paul


Re: [jelly] classpath issues (was Re: [jelly] value-of ??)

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "Paul Libbrecht" <pa...@activemath.org>
> >I use CVS HEAD of Maven to build Jelly libraries and run the unit tests.
Or
> >add Maven targets to run certain sample programs.
>
> True, I could go in that route... it's not that perfect... I would say...
> (does the dependency system of maven actually crawl through
> dependencies ? i.e. can I say I am depending on a project ??)

Not quite. Though its easy to inspect any project and see its dependencies
(just look for //dependency in the project.xml of a Maven built project).


> I am currently making something that should depend on xml and ant
> tag-libraries...
> Compilation needed a bit  tweaking as well (especially the xml
> tag-library (currently retrying).
>
>
>http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/jelly/jelly-tags/swin
g
> /maven.xml?rev=HEAD
>
> I would have a simple wish: generate me a list of classpath from such
> target. That would be ideal!
> (and I am pretty sure many other people would want that...).

Maven can take care of that for you. Or Maven can generate an Ant build file
that does it for you? Or if you just wanted an XML file containing the
dependencies, try reusing the project.xml? If you want a String of what the
classpath should be for a projet, I'm sure that'd be easy to do also.
Either a new Maven plugin or a little bit of Jelly code in your maven.xml

James
-------
http://radio.weblogs.com/0112098/

__________________________________________________
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

Re: [jelly] classpath issues (was Re: [jelly] value-of ??)

Posted by Paul Libbrecht <pa...@activemath.org>.
>The recent refactoring of the Jelly build system should have fixed this now.
>e.g. you could just build the XML library for Jelly using only the jars it
>requires to build and run the unit tests.

More precisely, it goes in the good direction for that... indeed.



>I use CVS HEAD of Maven to build Jelly libraries and run the unit tests. Or
>add Maven targets to run certain sample programs.

True, I could go in that route... it's not that perfect... I would say...
(does the dependency system of maven actually crawl through 
dependencies ? i.e. can I say I am depending on a project ??)

I am currently making something that should depend on xml and ant 
tag-libraries...
Compilation needed a bit  tweaking as well (especially the xml 
tag-library (currently retrying).

>http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/jelly/jelly-tags/swing
/maven.xml?rev=HEAD

I would have a simple wish: generate me a list of classpath from such 
target. That would be ideal!
(and I am pretty sure many other people would want that...).

Thanks.

Paul

Re: [jelly] classpath issues (was Re: [jelly] value-of ??)

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "Paul Libbrecht" <pa...@activemath.org>
> Currently trying to reproduce this and... had to move the
> installation to another computer so... of course... the classpath had
> to be reconfigured, as guessed, it was DOM-4j-dev-7 that I was using.
> I'll dig more when I'm through with this test...
>
> The general question of classpath is a slight (or a big?) trouble:
> I'd like to keep the dependencies as small as possible so I am just
> using a file to store all the jars that I want to use (and not make
> "all jars in repository" like in the maven-generated build.xml, it
> includes several versions of, e.g. DOM 4j !!).

The recent refactoring of the Jelly build system should have fixed this now.
e.g. you could just build the XML library for Jelly using only the jars it
requires to build and run the unit tests.


> This file is hand produced when I need it. But I realize now that I
> will not get an update of the classpath (I did not get it in my case).
>
> How to maintain an up-to-date classpath for Jelly ?
> I fear this is closer to a maven debate.

You're right :-)

I use CVS HEAD of Maven to build Jelly libraries and run the unit tests. Or
add Maven targets to run certain sample programs.

e.g. take a look at the maven.xml for the swing library which has a number
of targets for running demo applications in a forked JVM using the classpath
from the Maven dependencies as well as including the java and test code in
the classpath too.

http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/jelly/jelly-tags/swing
/maven.xml?rev=HEAD

James
-------
http://radio.weblogs.com/0112098/

__________________________________________________
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

[jelly] classpath issues (was Re: [jelly] value-of ??)

Posted by Paul Libbrecht <pa...@activemath.org>.
Currently trying to reproduce this and... had to move the 
installation to another computer so... of course... the classpath had 
to be reconfigured, as guessed, it was DOM-4j-dev-7 that I was using. 
I'll dig more when I'm through with this test...

The general question of classpath is a slight (or a big?) trouble: 
I'd like to keep the dependencies as small as possible so I am just 
using a file to store all the jars that I want to use (and not make 
"all jars in repository" like in the maven-generated build.xml, it 
includes several versions of, e.g. DOM 4j !!).
This file is hand produced when I need it. But I realize now that I 
will not get an update of the classpath (I did not get it in my case).

How to maintain an up-to-date classpath for Jelly ?
I fear this is closer to a maven debate.

Thanks.

Paul


>From: "Paul Libbrecht" <pa...@activemath.org>
>To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
>>  (how generic is the transform tag ? I got surprised to be required to
>>  put xalan in, I would have expected TRaX to be used...).
>
>The transform tag uses TRaX so it should work equally well with Saxon too.
>
>>>  Yet another option could be to pass values into the stylesheet as a
>>>  parameter.
>>
>>  That sounds a bit fuzzy to me but would be definitely elegant!
>>  How would you do this ?
>
><x:transform xml="foo.xml" xslt="foo.xsl">
>     <x:param name="a" value="${something}"/>
>     <x:param name="b" value="${anotherThing}"/>
></x:transform>

Re: [jelly] value-of ??

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "Paul Libbrecht" <pa...@activemath.org>
To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
> (how generic is the transform tag ? I got surprised to be required to 
> put xalan in, I would have expected TRaX to be used...).

The transform tag uses TRaX so it should work equally well with Saxon too.

>> Yet another option could be to pass values into the stylesheet as a
>> parameter.
>
> That sounds a bit fuzzy to me but would be definitely elegant!
> How would you do this ?

<x:transform xml="foo.xml" xslt="foo.xsl">
    <x:param name="a" value="${something}"/>
    <x:param name="b" value="${anotherThing}"/>
</x:transform>

James
-------
http://radio.weblogs.com/0112098/
__________________________________________________
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

Re: [jelly] value-of ??

Posted by Paul Libbrecht <pa...@activemath.org>.
Le vendredi, 17 jan 2003, à 20:03 Europe/Berlin, James Strachan a écrit 
:

> It'd be a fairly minor patch to the transform tag to allow a node or 
> nodeset to be passed in as the source XML...
> <x:parse var="doc" xml="foo.xml"|/>
> <!-- define a variable to be the result of an XPath -->
> <x:set var="input" select="$doc//foo[@bar='abc']"/>
> <!-- now pass in the nodes to XSLT -->
> <x:transform xslt="foo.xsl" xml="${input}"/>

Yes, that would be simple and efficient... for sure !
(how generic is the transform tag ? I got surprised to be required to 
put xalan in, I would have expected TRaX to be used...).

> Yet another option could be to pass values into the stylesheet as a
> parameter.

That sounds a bit fuzzy to me but would be definitely elegant!
How would you do this ?

> Paul

Re: [jelly] value-of ??

Posted by Paul Libbrecht <pa...@activemath.org>.
>Whoah that sound like a bug. Was it definitely using dom4j-dev-8.jar?
>
>http://www.ibiblio.org/maven/dom4j/jars/
>
>Any chance you could supply some example XML & XSL docs you used that
demonstrate the problem?

Here we are:

	<j:file name="blop.xml">
		<b><c:c xmlns:c="blop">bliop</c:c></b>
		</j:file>

produces:

>>   cat blop.xml

	<?xml version="1.0" encoding="UTF-8"?>
		<b><c:c xmlns:c="blop>bliop</c:c></b>

The xmlns:c="blop is missing its end-quote...

Paul

Re: [jelly] value-of ??

Posted by James Strachan <ja...@yahoo.co.uk>.
Phew, glad its working for you Paul :-)

From: "Paul Libbrecht" <pa...@activemath.org>
To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
>
> I encountered two issues there:
> -> how to know the script-file-name, is it a variable ?

I'm not sure I follow. The file name of the scripts you're iterating over?
You could just output ${file.name} in your example you supplied and that'd
make the file name available to XSLT.

> -> the (currently used in jelly's maven-imported) DOM4j outputter is
> broken, it forgets the namespace declarations closing-quote.

Whoah that sound like a bug. Was it definitely using dom4j-dev-8.jar?

http://www.ibiblio.org/maven/dom4j/jars/

Any chance you could supply some example XML & XSL docs you used that
demonstrate the problem?

James
-------
http://radio.weblogs.com/0112098/

__________________________________________________
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

Re: [jelly] value-of ??

Posted by Paul Libbrecht <pa...@activemath.org>.
Le samedi, 18 jan 2003, à 22:33 Europe/Berlin, Paul Libbrecht a écrit :
> Unfortunately, it does not work. Even the following outputs nothing:
> <x:parse var="blop"><a><b></b></a></x:parse>
> <x:copyOf select="$blop/*"/>


Real apologies.
It does output. It was all a question of updating the whole shebang 
(maven and jelly... and go along the tag libraries...).

And James' suggestion was working. Something similar to:

> <x:parse var="doc">
	<root>
		<j:forEach var="file" items="${fileList.iterator()}">
			<log:info>Going around ${file.toURL()}</log:info>
			<aFileContainer href="${file.toURL().toExternalForm()}">
				<j:include uri="${file.toURL().toExternalForm()}"/>
				</aFileContainer >
			</j:forEach>
		</root >
	</x:parse>
> <x:transform xslt="foo.xsl">
>   <!-- stream the result nodes as SAX events into XSLT -->
>   <x:copyOf select="$doc"/>
> </x:transform>

Performs well at merging documents and applyin my transformation on the 
merge.

I encountered two issues there:
-> how to know the script-file-name, is it a variable ?
-> the (currently used in jelly's maven-imported) DOM4j outputter is 
broken, it forgets the namespace declarations closing-quote.

Paul


Re: [jelly] value-of ??

Posted by Paul Libbrecht <pa...@activemath.org>.
Le vendredi, 17 jan 2003, à 20:03 Europe/Berlin, James Strachan a écrit 
:
> Or we could do this instead right now I think, which is similar...
> <x:parse var="doc" xml="foo.xml"|/>
> <x:transform xslt="foo.xsl">
>   <!-- stream the result nodes as SAX events into XSLT -->
>   <x:copyOf select="$doc//foo[@bar='abc']"/>
> </x:transform>


That is exactly what I was suggesting when requesting something like an 
"exec".

Unfortunately, it does not work. Even the following outputs nothing:

<x:parse var="blop"><a><b></b></a></x:parse>
<x:copyOf select="$blop/*"/>
	
Is this expected to work ? Then I'd really give it a chance, it's 
exactly what I would need.

I have two reasons to doubt it is expected to work, mostly due to my 
ignorance:

- isn't the parse's body actually parsed at script-load-time ? i.e. 
much before any doTag is called ?
- isn't copyOf actually supposed to pipe its things into >>output<< ie 
not into the script ?? It means being a child content or being fed to 
output is completely different. Is the <x:transform>, when invoked on 
its body, expected to transform the output of its child content ?? 
(that would be the most sensible approach, it would allow you to have 
other things in there... like for loops or... another transform 
element...).

Or maybe my whole little doubt is a personal misunderstanding mostly 
due to the fact that documentation says that <x:transform> can be 
applied on its body but is actually applied on >>the output of its 
body<< (which is the same when feeding non-script tags but not at all 
otherwise).
In this case, my apologies.

Paul


Re: [jelly] value-of ??

Posted by James Strachan <ja...@yahoo.co.uk>.
> Jellyers,
>
> I seem to be missing an element that does the following: I have an xml
> parsed into a variable using, eg, xml:parse. Now I'd like to address
> this to the xml:transform element... without outputting it, of course !

It'd be a fairly minor patch to the transform tag to allow a node or nodeset
to be passed in as the source XML...

<x:parse var="doc" xml="foo.xml"|/>

<!-- define a variable to be the result of an XPath -->
<x:set var="input" select="$doc//foo[@bar='abc']"/>

<!-- now pass in the nodes to XSLT -->
<x:transform xslt="foo.xsl" xml="${input}"/>


Or we could do this instead right now I think, which is similar...

<x:parse var="doc" xml="foo.xml"|/>

<x:transform xslt="foo.xsl">
  <!-- stream the result nodes as SAX events into XSLT -->
  <x:copyOf select="$doc//foo[@bar='abc']"/>
</x:transform>


Yet another option could be to pass values into the stylesheet as a
parameter.

James
-------
http://radio.weblogs.com/0112098/

__________________________________________________
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