In order to build a system that uses tokens to output different content types (xml, html5, json) I have three master templates, one for each type, in which I've set the xsl:output tag to either xml, or text.

I'm using a switchboard template to pull in all three, as each page on the site will be able to output different content with the provided api keys to make the site very flexible and to avoid having a separate api area.

I'm then pulling that switchboard in to each page and using template modes to create different output, and it's working for html which I've started building, unless I have the json template imported before the xml or html5 ones. If I do this, then all of the content comes out as text, as it's declared in the output tag.

After all that waffle, I'll now get to the point...

I have set the json master template to be imported first so that the others override it to xml output, but I'm envisaging issues when I get to creating the json. Does anyone know if this could cause problems with my json output? Does it matter that the output method is xml, as it does the other way around?

I think you can set xsl:output in your page templates as well, could that help you circumvent the multiple master templates situation?

I could, but the problem there is I have a template for each type of output.

I may just have to rethink this set up a little :(

Found out last night it does indeed affect the output, as it appends the xml tag at the top. Bummer.

Not if you set omit-xml-declaration="yes" in your xsl:output.

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