[xsl] creating a XSL from multiple files

Subject: [xsl] creating a XSL from multiple files
From: "Mho Salim" <mho@xxxxxxxxxxxx>
Date: Mon, 1 Sep 2003 14:53:56 -0600

I use XSL style sheets to create vxml streams dynamically.  My stylesheets
generally have four sections inside the   <xsl:template match="/myform">
</xsl:tamplate> block. Three of these sections, including parameter
declarations for the transformer (params), the variable declarations for the
VXML processor (vars)and a group of VXML <Form> tags that are repeated all
the time (sels).

The fourth section include a few vxml <form> blocks that are unique to each

I have successfully used the construct
<!DOCTYPE xsl:stylesheet [
  <!ENTITY params SYSTEM 'params.xml'>
  <!ENTITY selday SYSTEM 'sels.xml'>
  <!ENTITY vars SYSTEM 'vars.xml'>
and then later used &params; etc. where I needed them.

This is OK and the transformers work fine and the generated code runs great.
The only problem is that the the three ".xml" files are not properly
formatted files since I just took the declerations out of my XSL file and
stuck them in separate files with a .xml extension for lack of imagination.

Also my XML editor (I use Oracle Jdeveloper) complains when it is looking at
my stylesheets because it does not think it can find these files (the
transformer; I use javax.xml.transform.Transformer; works great, though).

Is there a way to properly format these files or is there a more respectable
way of accomplishing this objective?

Thanks for your help,


Below is an outline of my template:

<?xml version="1.0" encoding="UTF-8"?>
<!-- I put the DOCTYPE decleration here -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  <xsl:output method="xml" omit-xml-declaration="yes"/>
  <!-- root template -->
  <xsl:template match="/myform">
    <!--these are the parameters that get loaded at transformation time -->
    <xsl:param name="tid">      <xsl:value-of select="tid"/>    </xsl:param>
    <!--there is a bunch of these and they are the same most of the
ime.  -->
    <!--I put the &params; decleration here instead of all of these  -->

    <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml";
          xmlns: myvxmlsupplier="http://www.myvxmlsupplier.com";>

	<!-- here I have a list of parameters that I use for the VXML tags. -->
      <var name="_result" expr="'Hung up'"/>
      <var name="_selection" expr="'none'"/>
      <var name="_selectedtime" expr="'x'"/>
    <!--there is a bunch of these and they are the same most of the time
also.  -->
    <!--I put the &vars; decleration here instead of all of these  -->

	<!-- this is the code that is specific to each stylesheet -->
      <form id="MainMenue">
		<!-- stuff for MainMenue form -->
      <form id="nextitem">
		<!-- stuff for nextitem form -->

	<!-- here is again some code that gets copied in each stylesheet -->
      <xsl:for-each select="/myform/thisrecord">
        <xsl:variable name="apptday"> <xsl:value-of select="apptday"/>
        <xsl:variable name="...">
          <xsl:value-of select="..."/>
        <form id="{$tid}">
      <form id="timeofday">
    <!--I put the &sels; decleration here instead of all of these  -->


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

Current Thread