4 users online. Create an account or sign in to join them.Users

Search

I have a template that is saved as a utility that will be a master template (like in the default installation of Symphony.) This master template holds a basic html structure and calls all css styles, I have removed the calls to the style sheet etc.

Example follows of Master.xsl :

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


<xsl:variable name="is-logged-in" select="/data/events/login-info/@logged-in"/>
 <xsl:template match="/">
  <html>
   <head>
    <title></title>
     </head>
     <body></body>
  </html>
</xsl:template>
</xsl:stylesheet>

In the page that uses the Master.xsl template, I have the import rule etc, and it works.

First Page example:

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

<xsl:import href="../utilities/master.xsl"/> 

<xsl:template match="data" >

</xsl:template>

</xsl:stylesheet>

Some questions : 1) In this First Page, I do have a data source set that brings in entrys who’s source is data/entry/entry. I can not get the entry to show up in the body (much less at all) tag as set up in the master.xsl. I have done ?debug and the xml is reaching the front end.

2) I can not get anything to read inside the (even if I just type hello world) First Page template.

<xsl:template match="data" >

</xsl:template>

sigh. Sorry for the dumb question.

In between your <body> tags in the master template, you’ve got to include the generic:

<xsl:apply-templates />

See here for more info.

Nice, is the documentation you were talking about?

yeah I tried <xsl:apply-templates /> that connects the two, but for some reason only contents from the master show up and not the Page…

good grief…… :( Your right. I thought it was in there.

SO by applying it in the <body> <xsl:apply-templates /> </body> of the main.xsl then in the new page that uses this, it will place whatever new code in the body tag because it was called from this location.

Thanks Czheng,

One last question :)

in the master.xsl I am pulling in another file called text.xsl,

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

      <xsl:template>
         <h1>Quotation will go here.</h1>
       </xsl:template>

   </xsl:stylesheet>

I am confused on how to pull the h1 tag. I tried giving the xsl: template match=”test” then use a select=”test” but that would not work because match means its matching an xml element?

you can

<xsl:call-template name="your-template-name">
    <!-- optionally -->
    <xsl:with-param name="h1" select="'Quotation will go here.'"/>
    <!-- or -->
    <xsl:with-param name="h1" select="xml-node"/>
</xsl:call-template>

thanks Icek.

Couple questions if you don’t mind.

the first option : If not mistaken, seems to me I would be actually creating the parameter h1 in the template that I am calling from? Then I would not need to specify the tag just if it is a string or node?

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.2 or above
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.0 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details