Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: setting DOCTYPE and also including a file in the output

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 1/1/2007 1:52:00 PM

danmc91 wrote:

> The next problem I'm having is how to include an extra file in the
> output.  I had some very old scripts which could parse html files with
> server side includes and produce static html files that didn't need a
> server with SSI enabled.  I'd been using this mechanism to include a
> standard footer and some navigation links on all web pages.  

The XSLT language has an xsl:include instruction to include stylesheet 
modules. Then there is the document function to load secondary XML 
documents to be processed besides the main XML input.

That means you have two choices, if the footer is a snippet of 
well-formed X(HT)ML (e.g.
   <div xmlns="http://www.w3.org/1999/xhtml">
     <p>....</p>
   </div>
) then you can pull it in with the document function and simply copy it 
to the result tree e.g.
   <xsl:copy-of select="document('footer.xml')/*"/>
Note the namespace declaration above in the snippet, if your aim is to 
output XHTML then the separate file needs to have the XHTML namespace 
declaration present if you simply want to copy the elements.

Alternatively you could write a stylesheet module with a named template 
making up the footer e.g.
   <xsl:template name="make-footer" xmlns="http://www.w3.org/1999/xhtml">
     <div>
       <p>...</p>
     </div>
   </xsl:template>
then include that stylesheet with xsl:include and call e.g.
   <xsl:call-template name="make-footer"/>
where you want to include the footer.

These are the tools XSLT 1.0 offers, additionally you might want to look 
into XInclude to compose XML from different sources independent of XSLT.
-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent