You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by "Berg, Philip" <pc...@indiana.edu> on 2002/10/04 22:18:46 UTC

Arbitrary Sorting w/o document()?

I'm refering to the two faq's here (16 & 17):
http://www.dpawson.co.uk/xsl/sect2/N6461.html#d195e526

16 is exactly what I need and that is working on my local machine.  Upon
release of this project, however, the XML and stylesheet will only exist
in memory.  Thus I can't be using document().  I already tried that and
the transformation dies with an EmptyStack exception, while it goes thru
without the sort (and thus document()).

17 then says (last paragraph) that an alternative is to have the desired
data in the XML file.  I'll probably have a hard time convincing the
team responsible of the XML to include that data.
So then it goes on saying that if I put it in the stylesheet (xsl) one
would have to use "document()".

So, is there no other way? I guess I got bad news for my team then.  :(

thanks,
Philip

Re: Arbitrary Sorting w/o document()?

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Berg, Philip wrote:
> I'm refering to the two faq's here (16 & 17):
> http://www.dpawson.co.uk/xsl/sect2/N6461.html#d195e526
> 
> 16 is exactly what I need and that is working on my local machine.  Upon
> release of this project, however, the XML and stylesheet will only exist
> in memory.  Thus I can't be using document().  I already tried that and
> the transformation dies with an EmptyStack exception, while it goes thru
> without the sort (and thus document()).
> 
> 17 then says (last paragraph) that an alternative is to have the desired
> data in the XML file.  I'll probably have a hard time convincing the
> team responsible of the XML to include that data.
> So then it goes on saying that if I put it in the stylesheet (xsl) one
> would have to use "document()".
> 
> So, is there no other way? I guess I got bad news for my team then.  :(

You can use a variable and an extension function for converting
RTF to node sets. Basically every XSLT processor has one, usually
called xx:node-set(), whith xx bound to the processor specific
namespace for its extension funxtions.
   <xsl:variable name="map">
     <mm>
      <m name="Jan" num="1/>
      ...
     </mm>
   </xsl:variable>
   ...
    <xsl:for-each ...>
      <xsl:sort select="xx:node-set($map)/mm/m[@name=.]/@num"/>

Look up details in your processor's documentation.
BTW this kind of pure XSLT questions is better asked on the
XSL list
  http://www.mulberrytech.com/xsl/xsl-list/

J.Pietschmann