Search

Hi folks, I've just started trying out Symphony for a project I'm working on that interacts with an API serving XML. I've created a data source that points to the relevant API, and have created a page pointing to the appropriate data source.

When I try to hit up the page in the browser, I get the following error:

"This XML file does not appear to have any style information associated with it"

This being my first time round the block with Symphony and XSLT - can anyone point me in the right direction? best regards SWK

Maybe the Type of your Symphony Page is XML when you need a default HTML display? ;)

Has your page's XSL Stylesheet been created in the /workspace/pages folder?

"This XML file does not appear to have any style information associated with it"

there should be additional errors above this one. can you also share your code and maybe a snippet of your dynamic datasource with us?

No, that's not an error. It is a simple browser message which occurs in Firefox or Safari (since 5.1). All it means is that the server response is XML (without any XSL). :-)

… exactly, I believe the Page Type of the Symphony Page is probably (incorrectly) set to XML. Leave it blank and it will show up as HTML (if the [master] template's xsl:output media-type attribute is set to text/html)

Hi folks, thanks for responding so soon!

@davidhund - I've left the page type blank, so I'm not getting the error. Would the XML be visible in view-source, or does the xsl need to make this available to HTML?

@fawx I'm afraid I can't share the content of the datasource at this moment - I'm under NDA.

I've mocked up some dummy XML that matches the content:

<response>
   <results>
      <person name="tom"></person >
      <person name="dick"></person >
      <person name="harry"></person >
   </results>
</response>

This is the xsl:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
    omit-xml-declaration="yes"
    encoding="UTF-8"
    indent="yes" />

<xsl:template match="/">
<h1><xsl:value-of select="$page-title"/></h1>
<div>
<xsl:for-each select="response/results/person">
   <div>
      <h2><xsl:value-of select="@name"/></h2>
   </div>
</xsl:for-each>
</div>
</xsl:template>

</xsl:stylesheet>

I'm getting nada...

@sunwukung you can view the XML and some other goodies if you add ?debug to the url. So www.yoursite.com/?debug would show the XML and other parameters.

Re: not getting the data in your XSL. My guess is that this is your 'master/base' template? If so you'd need to change your XPATH to include the root /data node (excuse me if my terminology is wrong here - I am a beginner too :) )

Try this: e.g. <xsl:for-each select="/data/results/person">…</xsl:for-each>

Bingo! Thanks david, that got the ball rolling for me. I wasn't aware of the existence of these additional nodes. Many thanks

Great. It seems you've got quite a bit of insight in Symphony already but it might be good to (re-)visit the Tutorials: the ?debug goodness is mentioned as well as examples of XPATH's etc.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details