[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] multiple input sources to Saxon


Subject: Re: [xsl] multiple input sources to Saxon
From: "Evan Lenz" <elenz@xxxxxxxxxxx>
Date: Wed, 10 Oct 2001 11:15:35 -0700

Lee Pollington wrote:
> I looking for direction in terms of an effective strategy for "munging"
> several input sources togethor to supply as a "super document" to Saxon.
We
> have multiple javax.xml.transform.sources, we want to combine them
togethor
> under a given root element and supply them to the transformer.

I'm curious as to what your goal is here. Perhaps you'd like to use XSLT as
a kind of query language over multiple documents without having to
explicitly invoke the document() function (and without knowing the URIs of
those documents)?

If that's the case, then another approach might be to use a top-level
parameter in your stylesheets, the value of which is bound by the external
API. That value could consist of a set of root nodes (the same as what's
returned by the document() function).

This would have the additional advantage that the id() function wouldn't
break and you wouldn't lose the information as to which document contains
which nodes. This would be important to support processing instructions and
comments outside of the root element in well-formed documents, as well as
documents that are only "well-balanced", e.g. an external general parsed
entity.

An example of what a particular "query" might look like:

<xsl:transform version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:param name="input"/>

  <xsl:template match="/">
    <bib>
      <xsl:for-each select="$input/bib/book[publisher='Addison-Wesley' and
@year > 1991]">
        <book year="{@year}">
          <xsl:copy-of select="title"/>
        </book>
      </xsl:for-each>
    </bib>
  </xsl:template>

</xsl:transform>

Email me privately about Java source code for achieving this. I've been
doing this very thing using SAXON.

Evan Lenz
XYZFind Corp.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords