On 2/22/2010 10:31 PM, Steven & Julia Hathaway wrote:
On 2/21/2010 7:44 PM, David Bertoni wrote:
On 2/20/2010 1:49 PM, BPederson wrote:
Dave-
I am still struggling with the concept, most likely because I started in
Xalan-J. From my perspective, it appears the implemetations are
considerably different. The vendor product I'm using makes the Xalan-C++
library call to do the stylesheet transformation. I unfortunately
have no
control over the application referencing the Xalan-C++ library. All I
have
control over is the XSLT, which I make the function extension call
from. In
Xalan-J, not a problem because the Xalan.jar file knows that Rhino is
available to handle my javascript and do the file read.
So correct me on this thought process for Xalan-C++:
No doubt I can create a C++ function extension to read the file but if I
can't embed it in the application referencing the Xalan-C++ library
to do
the stylesheet transformation, then I'm out of luck? Or is there a
way for
me to create this function extension as a stand-alone DLL that gets
called
when the Xalan-C++ library, called by the vendor application, comes
across
the function call in my XSLT.
Since C++ is a statically compiled language, there's no way to do the
kinds of things you can do in Java with scripting extensions.
It would be possible to extend Xalan-C++ with some sort of syntax to
describe how to load an extension function, but there's no current
facility for that. It's a bit messy, because there is no standard
cross-platform mechanism for loading and calling functions in shared
libraries.
You can write and compile an extension function into a DLL, but the
executable that initializes the Xalan-C++ library and does the
transformation would need to be modified to install your extension
function.
Dave
XSLT Version 1.0 as implemented in XALAN-C also supports the XPath
document(url) function that returns a node-set.
This allows you to have a composite document that is constructed from
multiple sources.
<xsl:for-each select="document('url-to-file.xml')">
<!-- the template content that processes the 'url-to-file.xml' node-set -->
</xsl:for-each>
You can use the document() function anywhere a node-set object is
specified. This capability requires no custom XPath extensions.
Most compliant XSLT processors implement the document() functon.
All complian XSLT processor must support the document() function.
However, if you look at the original post, you'll see the use case is
reading a text file and creating a text node, not parsing an XML document.
Dave
-- Steve Hathaway