Andrew,
I'm not sure which statements you are referring to, but, I do remember at
least one about not being able to produce multiple output documents during a
single XSL transformation process (which I believe is true). I don't
remember any about not being able to process multiple documents. Using
entities, it is very easy to process multiple documents without resorting to
the technique you describe though. In our case, we have essentially separate
XML documents with business object definitions in them. We define each
business object in separate XML documents like so (simplified for demo
purposes):
<?xml version="1.0" encoding="UTF-8"?>
<data_object name="Req">
<member name="reqNum" ...>
<display_name>Req Number</display_name>
</member>
<member name="title" ...>
<display_name>Position</display_name>
</member>
<member name="description" ...>
<display_name>Description</display_name>
</member>
<member name="dateUpdate" ...>
<display_name>Last Updated</display_name>
</member>
</data_object>
This Requisition (Req) business object definition would then be included in
the XML document that defines the Req Listing page like so (again,
simplified version):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE view_page SYSTEM "../xml/DTDs/ViewPage.dtd"
[
<!ENTITY req_data_object SYSTEM "../xml/objects/req.xml">
]>
<view_page>
&req_data_object;
<list object="Req">
<item name="reqNum"/>
<item name="title"/>
<item name="description"/>
</list>
</view_page>
I believe this use of entities is a fairly common practice for including
separate XML documents inside a root XML document element as demonstrated
above. Any XML parser should support this. I am then able to lookup
pertinent information about the "title" member of the "Req" object by using
a select expression like this:
select="/view_page/data_object[@name='Req']/member[@name='title']/display_na
me"
In the context of applying templates, I would have local variables for the
current list item being processed that contained "Req" in an objectName
variable and "title" in a memberName variable when the XSL processor was
applying templates to:
<item name="title"/>
Finally, our production system won't have hard-coded text for the
display_name elements. Instead, there will be an identifier for an I18n
resource. The transformation will put the appropriate call to a Java Bean
interface for retrieving the string resource from the appropriate localized
version of string resources at runtime using the identifier . This is one
simple example where our transformations produce Java code that makes calls
into Java Beans that do all the real work that can only be done at runtime
dynamically. Which is why we use JSP as the output format for our
transformations and don't go with a pure XML solution as suggested in
another message on this topic by someone else.
- Mike Van Riper
[EMAIL PROTECTED]
> -----Original Message-----
> From: Andrew S Tomlinson [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 12, 2000 7:08 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Model 2 & 3 Architecture
>
>
> Just a quick observation on a statement being repeated in
> several messages -
> namely that a single XSL file cannot process multiple XML documents.
> This is not actually true - it might not be a standard
> capability of all
> XSLT processors but LotusXSL comes with specific examples for handling
> multiple documents.
> I used this technique in one scenario to perform
> multi-lingual support for
> all my generated HTML by looking up current "label" nodes in
> an external
> *labels.xml* file.
> The line looked something like ....
>
> <xsl:value-of
> select="document('labels.xml')/LABELS/LABEL[@name=current()/@n
> ame]/*[name()=
> $language]" /></xsl:variable>
>
> ==============================================================
> =============
> To unsubscribe: mailto [EMAIL PROTECTED] with body:
> "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets