Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - setting DOCTYPE and also including a file in the output >Thread Next - Re: setting DOCTYPE and also including a file in the output Re: setting DOCTYPE and also including a file in the outputTo: 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/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
