--On Thursday, June 17, 2004 3:45 PM +0100 Tom Howe <[EMAIL PROTECTED]> wrote:

Secondly, can the StyleChooser only provide the name of the style to use
and not the actualy stylesheet file to use?

As Kip already said, StyleChooser's can't do that, but a StyleProvider *can*. The default StyleProvider is Apache::AxKit::Provider::File, which just pulls in a file from disk. But you can write your own provider in perl and have it provider whatever you want. The thing to be careful of is that AxKit likes to compile your XSLT once and keep the compiled version cached. So your provider will need to correctly implement the mtime method to provide a fake modification time for the stylesheet, so that it will be recompiled if necessary.


See <http://www.axkit.org/wiki/view/AxKit/ProviderHowTo#> for a HowTo on writing a provider. Its really just a perl module that provides certain specific methods that AxKit will call.


Thirdly, what I would like to do is have some module/code/chooser whatever make a decision about which stylesheet to apply whenever an XSLT stylesheet needs to be applied.

Ideally I could say something like,

1. Apply XSP
2. Apply XSLT - goes and checks stylechooser for stylesheet to apply
3. Apply XSLT - goes and checks stylechooser for stylesheet to apply
4. Return to browser


I do something similar to this IN my stylesheets, by using named templates. i.e.:
<xsl:template name="foo">
... something here ...
</xsl:template>


<xsl:template name="bar">
... something here ...
</xsl:template>

<xsl:template match="/">
 <xsl:choose>
   <xsl:when test="some-test-here">
     <xsl:call-template name="foo"/>
   </xsl:when>
   <xsl:when test="some other test">
     <xsl:call-template name="bar"/>
   </xsl:when>
   <xsl:otherwise>
     .. default style stuff here..
   </xsl:otherwise
 </xsl:choose>
</xsl:template>



That, combined with using xsl:include to include a stylesheet of common
operations, has been able to handle everything I've needed. My pipelines typically consist of 3 stylesheets, one thats the application layout level, one that renders HTML from the layout, and one that applies the site specific styling. If I need to pass extra data to one of the layers from the initial data source, I put it into a metadata node, and pass those through from layer to layer.



-David Nolan Network Software Developer Computing Services Carnegie Mellon University


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to