XSL Help Requested

Subject: XSL Help Requested
From: Youngmee Kim <youngmeekim@xxxxxxxxxx>
Date: Sun, 02 May 1999 22:43:18 -0500
I am one of the "newbies" to XML/XSL, having worked with XSL
seriously for a few weeks to a few months depending
on what's meant by serious.  I'd appreciate any help with
the questions I have.  I'll explain the context of my questions first.

We have translated our data model in XML and the goal is to generate
Web interface forms to effect changes in the data.  The data happens
to be in a relational database, which isn't really relevant to my
questions.  The data model is generic for all applications (what we
call services), but the forms are application (service) specific.
The forms obviously have to have the appropriate labels for field names etc.

Currently, I am trying to specify the generic rules to produce certain
type of HTML tags for different data types in XSL and process that
specification with one type of service specific data(1) to produce the
service specific XSL specification.  That (intermediate) service specific
XSL specifications are processed again with another type of service
specific data(2) to produce the final HTML files.  So the steps are
   generic XSL spec -> application specific XSL spec -> HTML files.
I am using LotusXSL0.16.5 as the XSL processing engine and so far
have tried to do everything with XSL spec without writing any additional
Java code interfacing to LotusXSL.  I could if I have to - I want
to know if that's what I need to do.

The generic specification looks something like the following:

<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";
                xmlns:qxsl="quote:http://www.w3.org/TR/WD-xsl";
                xmlns="http://www.w3.org/TR/REC-html40";
                result-ns="qxsl">

<xsl:template match="/">
  <xsl:pi name="xml">version="1.0"</xsl:pi>
  <qxsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";
                   xmlns="http://www.w3.org/TR/REC-html40";
                   result-ns="">

  <qxsl:template match="/">
    <HTML>
      <HEAD>
        <TITLE>Forms</TITLE>
        <SCRIPT LANGUAGE="JAVASCRIPT">
          <!-- Some generic Java Scripts for Validation go here for now. -->

          function checkNumericRange(min, max, obj) {
            temp = obj.value;
            if ( (temp < min) || (max < temp) ) {
              alert("Invalid input!");
              return;
            }
            obj.value = temp;
          }

        </SCRIPT>
      </HEAD>
      <BODY>
        <qxsl:apply-templates/>
      </BODY>
    </HTML>
  </qxsl:template>
  <qxsl:template match="Svc">
    .
    .
    .
  </qxsl:stylesheet>
</xsl:template>
.
.
.

<xsl:template match="ViewAttr">
  <qxsl:template match="...">
    .
    .
        <qxsl:when test=".[@satType='string']">
          <qxsl:choose>
          <qxsl:when test=".[@maxLength]">
            <TD><INPUT type="TEXT" name="{@vatName}" size="<@maxLength>" /></TD>
          </qxsl:when>
         .
         .
   </qxsl:template>
</xsl:template>

</xsl:stylesheet>

My first question has to do with the "<" in the Java fuction.
The XSL processor complains that I need an element there.
Enclosing the JavaScript function in <![CDATA[   function .... ]]>
worked - LotusXSL stripped the <![CDATA[ ]]> when it produced
my service specific XSL and it got into the HTML files as is.
Are there other (better) ways of doing this?

My second question has to do with the <INPUT ...> line.
I want the input line to show up in the intermediate XSL spec as
<INPUT type="Text" name="the_value_of_attribute_vatName" size="{@maxLength}" />
In other words, I can evaluate @vatName because it is available
in the first set of data to produce the intermediate spec, but the value
of @maxLength is available in the data(2) used to produce the final
HTML files.  I have not found a way to do this.

My third question is about including and importing files into
the XSL specification.  For example, maybe I can put the javascript
functions I need in (a) separate file(s) and generate lines to
include them.  However, I don't fully understand how to use these.
I did read the spec (Dec 1998), but I was wondering if there is
more explantory text and examples somewhere.  For example, include,
I understand is a textual replacement.  Then, does the included file
have to be a fully specified xsl specification starting with
<?xml version ..> and </xsl:stylesheet ..> etc.?  I think my questions
are basic, and for some reason, couldn't really find the answers.

Youngmee Kim
Current Thread