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

Re: importing/including a stylesheet with a dynamic na

Subject: Re: importing/including a stylesheet with a dynamic name (c an't)
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 31 Jan 2001 18:10:44 +0000
dynamic na
Hi Adam,

> Currently we use quasi XSL documents for the layout and the skin,
> pass them through compiling XSL to create the actual transform that
> we would apply. Since running transforms on the fly is costly
> compared to storing every possible combination of layout and skin,
> we compile all our transform ahead of time. I've thought about
> allowing the layout to specify which skins could be valid (that is
> load them all) and then use parameters to selectively call
> particular skins. This gets rather gruesome if I have a template
> that could concievable use all skins.

Would it be possible to store the information about the layout and the
skin in some XML that just held that information - some 'template.xml'
files for the various layouts and/or some 'skin.xml' files for the
various skins, and then access that information within the stylesheet
to apply it. As a very basic example, say you had a skin defined as:

--- myskin.xml ---
<skin>
  <style id="foo" background="black" colour="white" />
  <style id="bar" font="Verdana" size="2" />
</skin>
---

You could have the name of the skin passed in as a parameter:

<xsl:param name="skin-name" select="'defaultskin'" />

and then access the file for that skin using the document() function
and store it in a global variable:

<xsl:variable name="skin"
              select="document(concat($skin-name, '.xml'))/skin" />

You could then access the style information wherever you wanted to in
the stylesheet:

<xsl:template match="p">
   <p>
      <!-- copy the attributes of the 'foo' style -->
      <xsl:copy-of select="$skin/style[@id = 'foo']/@*" />
      <xsl:apply-templates />
   </p>
</xsl:template>

Would something like that be feasible/helpful?  It would at least mean
that there would only be one transform per request (rather than two,
the first creating the stylesheet for the second).  You might be able
to cache the skins (and/or layouts) in memory for quicker access.

Cheers,

Jeni

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



 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.