Re: [xsl] client side style sheets?

Subject: Re: [xsl] client side style sheets?
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 1 Feb 2001 14:37:43 +0000
Hi Paul,

> I am attempting to build a system in which a server generates XML
> data to which the client side then applies an XSLT. I'd like to use
> IE + MSXML3 as the client and have the client- side XSLT generate
> HTML. The server is a very tiny embedded HTTP server that dispatches
> to "response objects" that generate the XML output.

I was wondering whether there might be a way of doing this that
used document() to pull in the relevant data from the server.  You
could have stylesheets that operated on themselves, and used either a
parameter or something hard-coded into a separate document to identify
the source that they need.

For example, if your user defined an XML document on their client
with:

--- data.xml ---
<?xml version="1.0"?>
<xdbpage source="http://server.com/someresource.xml"; />
---

They could then have a number of stylesheets all of the general form:

--- display.xsl ---
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="display.xsl"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:variable name="dataURL"
              select="document('data.xml')/xdbpage/@source" />
<xsl:variable name="data"
              select="document($dataURL)" />
                
<xsl:template match="/">
   <xsl:apply-templates select="$data/*" />
</xsl:template>

<!-- rest of the stylesheet formats the data from the server -->
                
</xsl:stylesheet>
---

Opening the stylesheet that they wanted to use to view the data would
cause the stylesheet to run on itself (the xml-stylesheet processing
instructions can be hardcoded on the stylesheet). The stylesheet would
then use the information in the data.xml file to identify which data
should be retrieved and formatted, fetch it from the server, and then
transform it.

Does that make sense?  Does it do what you were after?

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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


Current Thread