Glad it's going well. We've been working hard on a successor product, Saxon-JS,
which hopefully will retain all the good things in Saxon-CE and fix some of the
problems.
On 20 Jul 2016, at 13:56, Chris Despopoulos
despopoulos_chriss(_at_)yahoo(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
I wanted to provide an update on my experience with Saxon-CE. The bottom
line is, I'm getting transforms as strings out of the processor -- it looks
like I can use it to integrate DITA content into a product GUI. This is
truly awesome -- Many thanks to Dr. Kay.
I get a new processor with an XSLT file set to it, and then call
var result = proc.transformToDocument(myXml).
The XSLT starts like so:
<xsl:template match="topic">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
and then calls whatever other templates I need. The COPY passes the result
out through the processor.
Chances are, people who know XSLT better than I would say I'm doing this in a
bone-headed way. It works -- I definitely need a string result, either as
JSON, or I need HTML that I can then process further... Say execute an API
call to stitch real-time data into the content. So this is something that
works for what I need.
transformToDocument() returns an XML document node containing the result of the
transformation. The most trivial example of an XML document is where there's a
document node owning a single text node, which for most practical purposes you
can treat as string output.
I need to learn more about caching and life cycle for the processor. I'm
wondering if I should create a singleton for the processor and then set
properties as needed for each invocation.
The Xslt20Processor holds the compiled stylesheet, so you can reuse it to run
multiple transformations provided they use the same stylesheet. However, it
also holds per-transformation state, so you shouldn't start a new
transformation while another one is still active. Normally our approach has
been to fire off new tasks in response to user events from within the
stylesheet itself, and that works fine.
Also, I wonder if the browser caches XSLT files that I get via
Saxon.requestXML. If not, I need to do my own caching. Anyway, I still have
homework to do, but Saxon-CE is looking very nice!
Yes, I'm no expert on the internals of browsers but I think it's safe to assume
that the browser will cache such resources whenever it can. Even when you would
prefer it not to...
Michael Kay
Saxonica
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--