Using Includes in report XSLT

Friday, July 16, 2021
Avatar

There are several XSLT templates we are re-using across documents - take for example the format-date template from the default Spira doc sections. We now also have sections that (for the Word export) add house style stuff like headers, company logo's, page numbering, etc. This could all be placed in separate templates, but this still means the XSLT code needs to be copied for every doc template.

We'd like our xsl files to reference the shared 'generic' templates instead.

Is it possible to use the xsl include feature and if so, what is the 'base' folder on the server where the parser will look for these files while generating the reports (using absolute paths would be possible too of course) ?

We would like to build up a little 'library' of re-used xslt template snippets to get rid of the duplication. Also, this would make adapting our house style a LOT easier.

Or is there some other solution to this than xslt includes? Are there examples available for this?

 

2 Replies
Tuesday, July 20, 2021
Avatar
re: dl.pie Friday, July 16, 2021

 

Update: using include as specified in the XSLT 1.0 standard gives me an 'XSLT parsing error'. Eventlog tells a bit more (see below) - most relevant thing I pick up is 'Resolving of external URIs was probibited.' - does this mean including 'external' content is not possible? I'm simply using  <xsl:include href="<full local path>" />

 

XSLT compile error.In APPLICATION.Web.Services.Ajax.BackgroundProcessService::LaunchNewProcess_StartProcessing:

Messages:XSLT compile error.

[System.Xml.Xsl.XslLoadException]Resolving of external URIs was prohibited.

[System.Xml.XmlException]

Stack Trace:at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)at System.Xml.Xsl.Xslt.XsltLoader.Load(Compiler compiler, Object stylesheet, XmlResolver xmlResolver)at System.Xml.Xsl.Xslt.Compiler.Compile(Object stylesheet, XmlResolver xmlResolver, QilExpression& qil)at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)at APPLICATION.Business.ReportManager.CreateCustomReportSection(Int32 userId, Int32 projectId, StringBuilder& reportText, String query, String header, String footer, String template, Boolean isXmlRawFormat, String reportFormatToken, String timezoneId, UpdateBackgroundProcessStatus updateBackgroundProcessStatus, Int32 progress, Nullable`1 releaseId)at APPLICATION.Business.ReportManager.GenerateReport(Int32 userId, Int32 projectId, Int32 projectTemplateId, Int32 reportId, String queryString, String timezoneId, String appRootPath, UpdateBackgroundProcessStatus updateBackgroundProcessStatus)at APPLICATION.Web.Services.Ajax.BackgroundProcessService.LaunchNewProcess_StartProcessing(Object data)

 

Thursday, July 22, 2021
Avatar
re: dl.pie Tuesday, July 20, 2021

Hi

We use XslCompiledTransform which by default (for security reasons) does not allow the use of included XSLT files.

I will go ahead and log an enhancement request to have an admin setting that allows this.

Regards

David

Statistics
  • Started: Friday, July 16, 2021
  • Last Reply: Thursday, July 22, 2021
  • Replies: 2
  • Views: 258