# mod_xslt (Problem or HowTo?)

## prelle

Hi,

I'm trying to use mod_xslt with apache 2.0.48.

I managed to emerge the package successfully and try to find out what is necessary to make it run (I'm not exactly an apache expert).

This is what I've done so far:

In /etc/conf.d/apache2 I changed APACHE2_OPTS to

  APACHE2_OPTS="-D PHP4 -D XSLT"

In /etc/apache2/conf/modules.d/25_mod_xslt.conf added the following

entries:

```
<Location /xyz>

    SetOutputFilter mod-xslt

    AddHandler mod_xslt .html

</Location>
```

and because I wasn't sure that this was the right place I added

```
Alias /xyz /home/prelle/xyz

<Directory /home/prelle/xyz>

  Options Indexes

  AddHandler mod_xslt .html

  <IfModule mod_access.c>

    Order allow,deny

    Allow from all

  </IfModule>

</Directory>

```

to my commonapache2.conf

I now expected that a request for

http://localhost/xyz/foo.html

resulted in a request for a file foo.xml - but I simply get a 404. It looks like the module isn't reacting at all.

When I start the server /var/log/apache2/error.log  reads

  [Wed Jan 14 00:20:03 2004] [notice] Apache/2.0.48 (Gentoo/Linux) mod_xslt/1.0.5a PHP/4.3.4 configured -- resuming normal operations

which seems to indicate that mod_xslt is loaded.

What am I missing?

Regards,

  Stefan

----------

## maccorin

i'm having the same problems   :Evil or Very Mad: 

----------

## maccorin

well, just to let you know... i wasn't able to get it to load up .html requests... kept getting a 404 error, but it will load/translate the xml file if called directly.

Heres my 25_mod_xslt.conf file:

IfDefine XSLT>

  <IfModule !mod_xslt.c>

    LoadModule mod_xslt    extramodules/mod_xslt.so

  </IfModule>

</IfDefine>

<IfModule mod_xslt.c>

AddOutputFilter mod-xslt .xml

# <Location _REPLACE_ME_>

# <Location />

#    SetOutputFilter mod-xslt

# </Location>

</IfModule>

<Directory *>

    AddOutputFilterByType mod-xslt text/xml

</Directory>

----------

## ardavan@kyrandia

Greets... Have you found a solution yet? I have the same problem with mod_xslt and Apache 2.0.50. When I searched the net for mod_xslt, I found that there are several modules for apache by that name... Which one is in Gentoo? Does it have a homepage other that the non-working mod-xslt.com? (All it gives is a 403 error.)    :Confused: 

----------

## ReignStorm

hey,

i finally got it to work. its kind of weird but here goes.

1) emerged mod_xslt

2) edited /etc/conf.d/apache2:

   APACHE2_OPTS="-D XSLT"

3) edited /etc/apache2/conf/modules.d/25_mod_xslt.conf

  my mod_xslt.conf looks like:

```
<IfDefine XSLT>

  <IfModule !mod_xslt.c>

    LoadModule mod_xslt    extramodules/mod_xslt.so

  </IfModule>

</IfDefine>

                                                                                

<IfModule mod_xslt.c>

                                                                                

AddOutputFilter mod-xslt .xml

                                                                                

<Location "/">

    SetOutputFilter mod-xslt

</Location>

                                                                                

</IfModule>

                                                                                

<Directory "/var/www/localhost/htdocs">

    AddOutputFilterByType mod-xslt text/xml

</Directory>

```

4) restarted apache

5) created a file called index.xml in /var/www/localhost/htdocs

  it contains

```
<?xml version="1.0"?>

<?modxslt-stylesheet

  type="text/xsl"

  href="local://index.xsl"

  media="screen"

  alternate="no" title="For Links web browser"

  charset="ISO-8859-1" ?>

<card type="simple">

  <name>John Doe</name>

  <title>CEO, Widget Inc.</title>

  <email>john.doe@widget.com</email>

  <phone>(202) 456-1414</phone>

</card>

```

6) created a file called index.xsl in /var/www/localhost/htdocs

  it contains

```

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 

  version="1.0"

  xmlns="http://www.w3.org/1999/xhtml">                                                                                                                                              

<xsl:template match="card[@type='simple']">

<html xmlns="http://www.w3.org/1999/xhtml">

<title>business card</title><body>

<xsl:apply-templates select="name"/>

<xsl:apply-templates select="title"/>

<xsl:apply-templates select="email"/>

<xsl:apply-templates select="phone"/>

</body></html>

</xsl:template>

                                                                                                                                              <xsl:template match="card/name">

<h1><xsl:value-of select="text()"/></h1>

</xsl:template>

                                                                                                                                              <xsl:template match="email">

<p>email: <a href="mailto:{text()}"><tt>

<xsl:value-of select="text()"/>

</tt></a></p>

</xsl:template>

                                                                                                                                              </xsl:stylesheet>

```

now browse over to http://www.server.name/index.xml

it should work.

----------

## ReignStorm

umm, sorry, it doesn't quite work, i get the following errors:

```
[Sat Aug 14 20:58:10 2004] [error] [client 127.0.0.1] mod-xslt: /index.xml does not specify a loadable stylesheet

```

to fix that make sure that the xsl files aren't in the same directory as the xml files. or add in apache AddType text/xsl .xsl 

you can have a look at why it happens at the FAQ.

i followed that FAQ and it still doesn't work   :Crying or Very sad:   . i think i'm going to use Apache Axkit instead of mod_xslt.

----------

## bravecobra

 *ardavan@kyrandia wrote:*   

> Greets... Have you found a solution yet? I have the same problem with mod_xslt and Apache 2.0.50. When I searched the net for mod_xslt, I found that there are several modules for apache by that name... Which one is in Gentoo? Does it have a homepage other that the non-working mod-xslt.com? (All it gives is a 403 error.)   

 

http://www.mod-xslt2.com

but unfortunately I haven't got it working either. Something weird with the version number btw. What's the difference between mod_xslt and mod-xslt? Latest version on that website is 1.3.8 while 2.0.4 is in portage... I can't follow anymore...

However I found this: http://sourceforge.net/projects/mod-xslt/

----------

## bravecobra

I've trying to cook up an ebuild for this last mod-xslt2 package, but I'm no ebuild wizard...  :Sad: 

Could somebody help us with that, plz?

----------

