xsl-list
[Top] [All Lists]

Re: [xsl] including multiple files

2015-10-03 13:18:37
Dear Michael (cc XSL-List),

Thank for the quick response!

Best,

David

On 10/2/15, 6:24 PM, "Michael Kay" <mike(_at_)saxonica(_dot_)com> wrote:

You need to write a transformation that generates the stylesheet
containing the variable number of includes.

<xsl:namespace-alias stylesheet-prefix=³t² result-prefix=³xsl²/>
<xsl:template name=³gen-includes²>
 <t:stylesheet version=³2.0²>
 <xsl:for-each select=³uri-collection(Œsome-dir?select=*.xsl¹)²>
   <t:include href=³{.}²/>
 </xsl:for-each>
</t:stylesheet>
</xsl:template>

Michael Kay
Saxonica

On 2 Oct 2015, at 23:15, Birnbaum, David J djbpitt(_at_)pitt(_dot_)edu
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Dear XSL-list,

I fear that this may be a blind spot, or perhaps just a Bad Idea, but
I'm
developing an XSLT application that I'd like to modularize by creating a
series of smaller stylesheets that I can include with <xsl:include>.
There
will eventually be several dozen of them, the exact inventory will
change
over the course of development, and I didn't want to have to list them
all
individually, with separate <xsl:include> statements for each one. I
thought it should be possible to simplify the process by putting all of
the subsidiary stylesheets into a subdirectory, addressing it from
within
the main one with collection(), and iterating over the members of that
collection to pass the URL of each one to <xsl:include
href="somethingOrOther"/>. In this way, each time the transformation was
run, the main stylesheet would include whatever it found in the
subdirectory at run time.

I'm stumbling, though, because 1) <xsl:include> must be top-level and
2) I
can't iterate with <xsl:for-each> at the top level.

Can anyone point to a strategy that would let me <xsl:include> multiple
smaller stylesheets into a larger one without having to create a
separate
explicit <xsl:include> element for each of them?

Thanks,

David
djbpitt(_at_)gmail(_dot_)com




<Prev in Thread] Current Thread [Next in Thread>