Hi,

>> But as I mostly expected, this gave incorrect results. The spec never 
>> touches on doing such a thing. Is there any feasible way of doing this?
One 
I think you're jumping a gun stating the results were wrong. What did you
get and what did you expect?
XSLT specification is specific enough on the matter. You can read it here
http://www.w3.org/TR/xslt#sorting

>> thought was to somehow keep the java runtime and xalan loaded in memory, 
>> ready to fire off another thread as soon as they're called. Or some sort
of 
This sounds like a task for Java servlet containers. There works exactly as
you describe here. In addition you can cache XSLT compiled stylesheets and
thus further improve performance.
You can use JServ, Tomcat and many others to do this. I would go with
Tomcat, since it simplifies deployment a lot.
There're samples of servlets implementing XML/XSLT transformations in the
Xalan. I'm not sure how easy it would be to use it with PHP though. One way
to do it is to make calls to such a servlet via HTTP, but I'm not sure if
this'd be acceptable for you.

Thanks,
Dimitry

-----Original Message-----
From: Foxy Shadis [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 22, 2003 14:54
To: [EMAIL PROTECTED]
Subject: Xalan usage questions


Two questions, one specific about XSLT and one generally about Xalan.

First, I have a loop that runs like so:

<xsl:for-each select="$journal_entry">
<xsl:sort select="@jid" data-type="number" order="descending"/>
<xsl:if test="position()&lt;=2">
...
</xsl:if>
</xsl:for-each>

I would like to optimise it in a way similar to:

<xsl:for-each select="$journal_entry[position()&lt;=2]">
<xsl:sort select="@jid" data-type="number" order="descending"/>
...
</xsl:for-each>

But as I mostly expected, this gave incorrect results. The spec never 
touches on doing such a thing. Is there any feasible way of doing this? One 
option I've thought of would be to include the sort parameters in with the 
position portion, but this seems unweildy and error-prone, duplicating 
parameters each time. More importantly, though, does it matter at all, or is

the internal optimization more than capable of handling such cases without 
adding extra load?


Next, I'd like to integrate Xalan into my website, running Apache. I'm not 
much of a Java programmer now, never having put much into it, though I doubt

it would take much to learn. Instead my thought was to use PHP to call Xalan

(or XSLTC, though it doesn't have a lot of the EXSLT that Xalan does) 
whenever a page is requested. In order to reduce unbearable load-times, my 
thought was to somehow keep the java runtime and xalan loaded in memory, 
ready to fire off another thread as soon as they're called. Or some sort of 
plugin, so the PHP just calls a waiting plugin. The site is very 
low-traffic, so I'm not really worried about overloading my weak processor 
yet, except that initial load and shutdown overhead.

Feel free to tell me I'm being an quixotic Taskmaster. :) I'll probably just

have to figure out what all this servlet business is about. Any advice would

be grand!


Swiftpaw Foxyshadis, wildlife artist
[EMAIL PROTECTED] | http://foxyshadis.dyndns.org/

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus


_____________________________________________________
Revere Data, LLC, formerly known as Sector Data, LLC, is not affiliated with
Sector, Inc., or SIAC.

Reply via email to