You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Marcin Okraszewski <ok...@o2.pl> on 2004/03/11 15:41:36 UTC
Dynamic XML sorting ???
Hi,
I would like to sort some fragments of a generated XML. The problem is
that I would like to sort the XML by XPath specified in the generated
document. It might look like this:
<document>
<!-- ... -->
<sort:sort by="element/name">
<element>
<name>xdfs</name>
</element>
<element>
<name>asdfe</name>
</element>
</sort:/sort>
</document>
Is there any transformer that would do this (I couldn't find any)? Maybe
it is possible to do it in XSLT? I think that XSLT isn't able to handle
it, because it seems it can't evaluate XPath expressions that are stored
/source document/.
Regards,
Marcin Okraszewski
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Dynamic XML sorting ???
Posted by Alex Romayev <ro...@yahoo.com>.
--- Upayavira <uv...@upaya.co.uk> wrote:
> Marcin Okraszewski wrote:
>
> >
> >
> >
> >
> >>
> >> On Mar 11, 2004, at 6:41 AM, Marcin Okraszewski
> wrote:
> >>
> >>> Hi,
> >>> I would like to sort some fragments of a
> generated XML. The problem
> >>> is that I would like to sort the XML by XPath
> specified in the
> >>> generated document. It might look like this:
> >>>
> >>> <document>
> >>> <!-- ... -->
> >>> <sort:sort by="element/name">
> >>> <element>
> >>> <name>xdfs</name>
> >>> </element>
> >>> <element>
> >>> <name>asdfe</name>
> >>> </element>
> >>> </sort:/sort>
> >>> </document>
> >>>
> >>> Is there any transformer that would do this (I
> couldn't find any)?
> >>> Maybe it is possible to do it in XSLT? I think
> that XSLT isn't able
> >>> to handle it, because it seems it can't evaluate
> XPath expressions
> >>> that are stored /source document/.
> >>
> >>
> >>
> >> Can you set up a separate pipe that transforms
> the source to generate
> >> the XSLT that sorts the source (in the house
> that Jack built :-) ?
> >
> >
> > I haven't though about such solution! Yes, I could
> build the XSLT from
> > pipeline, but it would probably impact performance
> (I would have to
> > generate page twice - once for normal pipeline and
> second to build the
> > xslt).
>
> You wouldn't generate the page twice, put you'd be
> using two pipelines,
> and your XSLT wouldn't be cached, so it would be
> slower, but not
> necessarily that much slower.
>
> > I think I will better write a Java transformer -
> it shouldn't be very
> > difficult :-)
>
> Would undoubtably be quicker than the XSLT approach.
> If you can, make it
> a generic sorting transformer. Might be useful to
> some.
I would definitely be interested. Let me know if I
can help.
>
> Regards, Upayavira
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Dynamic XML sorting ???
Posted by Upayavira <uv...@upaya.co.uk>.
Marcin Okraszewski wrote:
>
>
>
>
>>
>> On Mar 11, 2004, at 6:41 AM, Marcin Okraszewski wrote:
>>
>>> Hi,
>>> I would like to sort some fragments of a generated XML. The problem
>>> is that I would like to sort the XML by XPath specified in the
>>> generated document. It might look like this:
>>>
>>> <document>
>>> <!-- ... -->
>>> <sort:sort by="element/name">
>>> <element>
>>> <name>xdfs</name>
>>> </element>
>>> <element>
>>> <name>asdfe</name>
>>> </element>
>>> </sort:/sort>
>>> </document>
>>>
>>> Is there any transformer that would do this (I couldn't find any)?
>>> Maybe it is possible to do it in XSLT? I think that XSLT isn't able
>>> to handle it, because it seems it can't evaluate XPath expressions
>>> that are stored /source document/.
>>
>>
>>
>> Can you set up a separate pipe that transforms the source to generate
>> the XSLT that sorts the source (in the house that Jack built :-) ?
>
>
> I haven't though about such solution! Yes, I could build the XSLT from
> pipeline, but it would probably impact performance (I would have to
> generate page twice - once for normal pipeline and second to build the
> xslt).
You wouldn't generate the page twice, put you'd be using two pipelines,
and your XSLT wouldn't be cached, so it would be slower, but not
necessarily that much slower.
> I think I will better write a Java transformer - it shouldn't be very
> difficult :-)
Would undoubtably be quicker than the XSLT approach. If you can, make it
a generic sorting transformer. Might be useful to some.
Regards, Upayavira
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Dynamic XML sorting ???
Posted by Marcin Okraszewski <ok...@o2.pl>.
>
> On Mar 11, 2004, at 6:41 AM, Marcin Okraszewski wrote:
>
>> Hi,
>> I would like to sort some fragments of a generated XML. The problem is
>> that I would like to sort the XML by XPath specified in the generated
>> document. It might look like this:
>>
>> <document>
>> <!-- ... -->
>> <sort:sort by="element/name">
>> <element>
>> <name>xdfs</name>
>> </element>
>> <element>
>> <name>asdfe</name>
>> </element>
>> </sort:/sort>
>> </document>
>>
>> Is there any transformer that would do this (I couldn't find any)?
>> Maybe it is possible to do it in XSLT? I think that XSLT isn't able to
>> handle it, because it seems it can't evaluate XPath expressions that
>> are stored /source document/.
>
>
> Can you set up a separate pipe that transforms the source to generate
> the XSLT that sorts the source (in the house that Jack built :-) ?
I haven't though about such solution! Yes, I could build the XSLT from
pipeline, but it would probably impact performance (I would have to
generate page twice - once for normal pipeline and second to build the
xslt).
I think I will better write a Java transformer - it shouldn't be very
difficult :-)
Regards,
Marcin Okraszewski
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Dynamic XML sorting ???
Posted by Alex Romayev <ro...@yahoo.com>.
Yes, you can have a pipeline, which generates your
XSL:
<map:match pattern="generate-my-stylesheet">
...
</map:match>
and then:
<map:transform src="cocoon:/generate-my-stylesheet"/>
-Alex
--- Mark Lundquist <ml...@wrinkledog.com> wrote:
>
> On Mar 11, 2004, at 6:41 AM, Marcin Okraszewski
> wrote:
>
> > Hi,
> > I would like to sort some fragments of a generated
> XML. The problem is
> > that I would like to sort the XML by XPath
> specified in the generated
> > document. It might look like this:
> >
> > <document>
> > <!-- ... -->
> > <sort:sort by="element/name">
> > <element>
> > <name>xdfs</name>
> > </element>
> > <element>
> > <name>asdfe</name>
> > </element>
> > </sort:/sort>
> > </document>
> >
> > Is there any transformer that would do this (I
> couldn't find any)?
> > Maybe it is possible to do it in XSLT? I think
> that XSLT isn't able to
> > handle it, because it seems it can't evaluate
> XPath expressions that
> > are stored /source document/.
>
> Can you set up a separate pipe that transforms the
> source to generate
> the XSLT that sorts the source (in the house that
> Jack built :-) ?
>
> ~ Mark
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Dynamic XML sorting ???
Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Mar 11, 2004, at 6:41 AM, Marcin Okraszewski wrote:
> Hi,
> I would like to sort some fragments of a generated XML. The problem is
> that I would like to sort the XML by XPath specified in the generated
> document. It might look like this:
>
> <document>
> <!-- ... -->
> <sort:sort by="element/name">
> <element>
> <name>xdfs</name>
> </element>
> <element>
> <name>asdfe</name>
> </element>
> </sort:/sort>
> </document>
>
> Is there any transformer that would do this (I couldn't find any)?
> Maybe it is possible to do it in XSLT? I think that XSLT isn't able to
> handle it, because it seems it can't evaluate XPath expressions that
> are stored /source document/.
Can you set up a separate pipe that transforms the source to generate
the XSLT that sorts the source (in the house that Jack built :-) ?
~ Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org