Is it possible to embed/combine XML+XSL?

P

pjfarley3

Hi all,

First-timer here, with a question about composing XML and XSL. I have
a need to send one XML file with NO external server references to an
end-user browser window; i.e., I would like to be able to do something
like having the href in the "xml-stylesheet" declaration be a "local"
reference, something like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="#Local_xsl"?>
....

Only I can't find a place to put the XSL so it could be referenced in
this way. Is it even possible?

So far as I can see from reading tutorials and faq's everywhere, no one
ever discusses an ability to combine both the XML and the XSL into one
stream sent to the end-user browser. Everyone seems to AssUMe you can
just put a remote URI in the href and get the XSL from a server
somewhere. I need to be able to NOT use a remote URI or to go back to
the server for any information, all must be contained in a single
stream sent to the browser.

If I am approaching this from the wrong direction, please point me in
the right one. RTFM's, pointers to info, etc. all appreciated.

Peter
 
J

Joe Kesselman

Uhm... If you're just going to send a single file, why not process the
file through the XSL stylesheet _before_ sending it -- either on demand
in the server, or by storing and serving the styled copy? (I've seen
setups that do both, and in fact more of those than client-side
stylesheets, since until relatively recently client-side styling wasn't
supported by enough clients that anyone would consider relying on it
unless they were writing both ends of the process.)
 
P

pjfarley3

Unfortunately, the server in this case also has no styling capability.
Not yet, anyway. I can generate the XML doc (which has the data the
application is returning to the end-user's browser) and I can craft the
XSL doc to present it the way the user wants to see it, but I can't
store the XSL on the server due to server maintainer recalcitrance
(i.e., human factors).

In the meantime, I need to get the application out there, so I'm
looking for a way around the human factors.

The only other solution I've come up with so far is an XHTML doc (and
embedded CSS2 for styling) with an XML data island for the data. It
will work, but I was hoping to "prove" the XSL solution.

If you have any other ideas, I'd appreciate hearing them.

Peter
 
J

Joe Kesselman

pjfarley3 said:
Unfortunately, the server in this case also has no styling capability.
Not yet, anyway. I can generate the XML doc (which has the data the
application is returning to the end-user's browser) and I can craft the
XSL doc to present it the way the user wants to see it, but I can't
store the XSL on the server due to server maintainer recalcitrance
(i.e., human factors).

I'm still sorta confused. If you could manage to embed the XSL into the
XML, as your original proposal suggested, you must be obtaining it from
somewhere. The same task ought to be able to apply the XSL to the XML as
easily as embedding it.

But... OK, let's assume you can't install an XSLT processor on the
server end, for whatever reason. What you've requested is possible, at
least theoretically. See
http://www.w3.org/TR/1999/REC-xslt-19991116#section-Embedding-Stylesheets
Of course this requires that the DTD or schema which defines your XML
allows the XSL elements to appear.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top