Eric Stockbridge wrote:

how can I name stylesheets for use with
Apache::AxKit::StyleChooser::PathInfo ?

<snip>

This is a bit of an RTFM question, but I'll answer it anyway.

There are essentially two ways you can approach this. If you are using httpd.conf or .htaccess files to associate stylesheets with your XML (using the AxAdd*Processor directives), then the following will apply (taken straight from the AxKit documentation):

<AxMediaType screen>
<AxStyleName #default>
AxAddProcessor text/xsl /styles/webpage_screen.xsl
</AxStyleName>
<AxStyleName printable>
AxAddProcessor text/xsl /styles/webpage_printable.xsl
</AxStyleName>
</AxMediaType>

This example assumes that all your files in a given directory will be processed by the same stylesheet. If you need to selectively associate a particular type of XML file with their own stylesheet, then you can use the other AxAdd*Processor directives. For instance:

<AxMediaType screen>
<AxStyleName #default>
AxAddRootProcessor text/xsl /styles/webpage_screen.xsl page
AxAddRootProcessor text/xsl /styles/book_screen.xsl book
</AxStyleName>
<AxStyleName printable>
AxAddRootProcessor text/xsl /styles/webpage_printable.xsl page
AxAddRootProcessor text/xsl /styles/book_printable.xsl book
</AxStyleName>
</AxMediaType>

Assuming you have two different types of XML content in your site, one whose root element is <page>, while the other's root element is <book>. This will automagically assign a different XSL stylesheet with your XML depending on the name of that root element. See the documentation for more Apache directives like those above.

Now, if you're using PIs in your XML files to associate stylesheets, there is a similar process you must go through.

Here is a snippet from an actual XSP page of mine that has three views - the default HTML view, a printable version of the HTML and a "pretty-printed" XML representation (redraws the raw XML color-coded for debugging).

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="." type="application/x-xsp"?>
<?xml-stylesheet href="/scamp/stylesheets/userlist.xsl" type="text/xsl"
title="default"?>
<?xml-stylesheet href="/scamp/stylesheets/userlist-print.xsl"
type="text/xsl" title="print" alternate="yes"?>
<?xml-stylesheet href="/scamp/stylesheets/pretty-print.xsl"
type="text/xsl" title="prettyxml" alternate="yes"?>

The first stylesheet just associates this XML file with the XSP processor. The next three <?xml-stylesheet?> PIs all have the added "title" attribute. The "default" title (and I'm assuming the absense of the alternate attribute) means this is - you guessed it - the default. The others, since they're defined as alternates, can be accessed by their titles.

I find the first method (using .htaccess files) much more flexible, but more cumbersome when you have a bunch of XSP pages that all need custom stylesheets.

--

-man
Michael A Nachbaur
The best way to predict the Future is to invent it.

PGP Public Key at http://www.nachbaur.com/pgpkey.asc
PGP Key fingerprint = 83DC 7C3A 3084 6A21 9A3F 801E D974 AFB4 BFD7 2B6F


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

Reply via email to