This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: including files


Nathan Shaw wrote:
> Next, I thought of using document() and found from one
> of Jenni's excellent posts, a good way to do this.
> However, because the files I am including are not
> really XML, but xhtml (some of them do not have a
> containing element), I am running into problems there
> as well.

I think you're on the right track. I would use document() but instead of
pointing directly to the file, point to a URI that, when resolved, will
deliver a well-formed document. You usually have the option of customizing the
URI resolver (see JAXP's javax.xml.transform.UriResolver interface, and
setUriResolver() on the Transformer or TransformerFactory) so that it delivers
whatever you need. 

For example, for document('urn:nate-frag.xhtml'), your URI resolver
could look for 'urn:nate-' and then know that it needs to return
something like

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wrapper [ <!ENTITY content SYSTEM "frag.xhtml"> ]>
<wrapper>&content;</wrapper>

Alternatively, you could put the document name in a query
string and point to a CGI-like application that returns what you need,
something like

  document('http://localhost/wrap-it.servlet?file=frag.xhtml')

where the wrap-it servlet returns the wrapper.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]