[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: client side style sheets?

Subject: RE: client side style sheets?
From: "Kevin Jones" <kjouk@xxxxxxxxxxx>
Date: Tue, 30 Jan 2001 19:41:26 -0000
client side xsl processing

>Two questions...
>
>1) Are there standard/easy ways to allow users to apply/associate
>   XSL transforms to/with XML data from some server source?

The only standard way I know is adding the stylesheet PI that you mention.

>
>2) How do I correctly do c) above?
>
>  <xsl:template match="xdbpage">
>    <xsl:processing-instruction name="xml-stylesheet">
>	 type="text/xsl"
>	 href="<xsl:value-of select="@display" />"
>    </xsl:processing-instruction>
>    <xsl:apply-templates select="document(@source)/*" />
>  </xsl:template>
>

This approach can not work with IE because it appears to only be able to
perform one transform for each XML file loaded. So outputting a PI does not
help as the output just gets rendered rather than being considered for a
further possible transform. I think the <xsl:apply-template> should have
been a <xsl:copy-of ... if you wanted this to happen.

Some more alternatives to think about may be,

1. Use some JavaScript in to perform the second transform. In this model I
think you can make your first code generate a HTML file which contains
JavaScript to perform the required transform. See Pg. 690 of Michael Kay's
"XSLT Programmers Reference" for an example similar to this.

2. Use <xsl:import href="..."> to create a master stylesheet as below. This
will quickly become unmanageable for large sites and will reduce the
transformation speed.

<xsl:import href="file://path/to/xslt/display.xsl"/>

<xsl:template match="xdbpage">
    <xsl:apply-templates select="document(@source)/*" />
</xsl:template>

3. Use a server side transform to create XML with stylesheet PI's in. In
this case you can use a scheme similar to what you first proposed. The
stylesheet/XML below should do what you need as a server side transform.
This can be done as a final stage before the XML is sent from the server but
may suffer from your original objection of requiring too many code
modification. It would also perform much better if implemented as a simple
text insertion.

<xsl:template match="xdbpage">
   <xsl:processing-instruction name="xml-stylesheet">
	 type="text/xsl"
	 href="<xsl:value-of select="@display" />"
    </xsl:processing-instruction>
    <xsl:copy-of select="document(@source)/*" />
</xsl:template>

Any body else have any good solution for the XSL-XML association problem on
a client.

Regards,
Kev.


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.