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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to