Plugin

Developer
Supported

XSLTransform

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Mark J. Reeves

     

You must be logged in to post.

XSLTransform error

Support Request

alamode
alamode

First off, thanks for your help and work.

Every time I try to view me Footer_test template through EE2, I receive an error:

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.

All templates are HTML currently.

I have the following:

Group :
Master_Includes

Template:
Footer_test

Footer_test code:

{exp:xsltransform xsl='xslt/footer_generic_720'}
    
<xml>
        <
footer>
            <
group>
                <
heading>Heading 1</heading>
                <
heading_path>http://www.site.com/heading1/</heading_path>
                
<link>
                    <
path>http://www.site.com/heading1/a/</path>
                    
<text>a</text>
                </
link>      
                <
link>
                    <
path>http://www.site.com/heading1/b/</path>
                    
<text>b</text>
                </
link>      
                <
link>
                    <
path>http://www.site.com/heading1/c/</path>
                    
<text>c</text>
                </
link>
            </
group>
            <
group>
                <
heading>Heading2</heading>
                <
heading_path>http://www.site.com/heading2/</heading_path>
                
<link>
                    <
path>http://www.site.com/heading2/d/</path>
                    
<text>d</text>
                </
link>      
                <
link>
                    <
path>http://www.site.com/heading2/e/</path>
                    
<text>e</text>
                </
link>      
                <
link>
                    <
path>http://www.site.com/heading2/f/</path>
                    
<text>f</text>
                </
link>
            </
group>
        </
footer>
    </
xml>
{/exp:xsltransform} 

AND

Group :
xslt

Template :
footer_generic_720

footer_generic_720 code :

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <
xsl:output method="html" indent="yes" encoding="utf-8" omit-xml-declaration="yes"/>

  <
xsl:template match="/">
    <
xsl:value-of select="footer/group/heading"/>
  </
xsl:template>
</
xsl:stylesheet

Thanks again.

Mark J. Reeves
# 1
Developer
Mark J. Reeves

Hi Brian,

I have not been able to reproduce the 500 Internal Server Error using MAMP Pro on my mac. Here’s what I’ve gotten working:

{exp:xsltransform xsl='xslt/footer_generic_720'}
    
<xml>
        <
footer>
            <
group>
                <
heading>Heading 1</heading>
                <
heading_path>http://www.site.com/heading1/</heading_path>
                
<link>
                    <
path>http://www.site.com/heading1/a/</path>
                    
<text>a</text>
                </
link>      
                <
link>
                    <
path>http://www.site.com/heading1/b/</path>
                    
<text>b</text>
                </
link>      
                <
link>
                    <
path>http://www.site.com/heading1/c/</path>
                    
<text>c</text>
                </
link>
            </
group>
            <
group>
                <
heading>Heading2</heading>
                <
heading_path>http://www.site.com/heading2/</heading_path>
                
<link>
                    <
path>http://www.site.com/heading2/d/</path>
                    
<text>d</text>
                </
link>      
                <
link>
                    <
path>http://www.site.com/heading2/e/</path>
                    
<text>e</text>
                </
link>      
                <
link>
                    <
path>http://www.site.com/heading2/f/</path>
                    
<text>f</text>
                </
link>
            </
group>
        </
footer>
    </
xml>
{/exp:xsltransform} 

xslt/footer_generic_720 contains:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <
xsl:output method="html" indent="yes" encoding="utf-8" omit-xml-declaration="yes"/>

  <
xsl:template match="/">
    
Hello <xsl:value-of select="."/>
  </
xsl:template>
</
xsl:stylesheet

Note that I used select=”.”. It outputs the entire tree of data without the XPath being refined.

My version of MAMP Pro is only supporting PHP 5.2.13 or PHP 5.3.2, both of which I’ve tried successfully.

So:

* What version of PHP are you on? The plugin was coded, and tested, to support 4 as well.

* Depending on your PHP version, does your server have the necessary XML & XSLT libraries? If you drop:

<? phpinfo() ?> 

Into a PHP file you should be able to see if there are any XML or XSL libraries loaded.

Those would be necessary. The 500 error may very well be due to the lack of a requisite PHP Library.

Let me know what you find?

Thanks,
Mark

alamode
# 2
alamode

Mark,

Thanks for the help again.

It looks like XSL was not installed. I put a request in for that to be enabled. I’ll let you know an update as soon as I can.

- Brian

alamode
# 3
alamode

I was able to render the following: 

Hello Heading 1 http://www.site.com/heading1/ http://www.site.com/heading1/a/ a http://www.site.com/heading1/b/ b http://www.site.com/heading1/c/ c Heading2 http://www.site.com/heading2/ http://www.site.com/heading2/d/ d http://www.site.com/heading2/e/ e http://www.site.com/heading2/f/ f

Thanks.

alamode
# 4
alamode

Mark,

Trying o expand on this, keeping in mind I have never used XML templates in EE, would it be better to use external XML or an XML template for this use?

In other words, inside of the

{exp:xsltransform xsl='xslt/footer_generic_720'
tags, is it possible to load in an XML file via something like
{embed="xml/footer_generic"

?

I have tried a few different ways, but haven’t had any success. I would like to use an XML file rather than a channel entry containing XML, so:

{exp:xsltransform xsl='xslt/footer_generic_720'}
    {embed
="xml/footer_generic"}
{
/exp:xsltransform} 

would be great. I don’t see why it wouldn’t work, but I have tried that and :

{exp:xsltransform xsl='xslt/footer_generic_720'}
    
<xml>{embed="xml/footer_generic"}</xml>
{/exp:xsltransform} 

due to the the error for missing ‘<’ tag in line 2.

Thanks,

Brian