Re: [xsl] initial template parameters

Subject: Re: [xsl] initial template parameters
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Thu, 18 Mar 2010 16:02:16 +0100
Robby Pelssers wrote:
Or you would have to keep a package folder structure like most programming languages do and even in javascript it is an adopted approach to create namespace like structures to have no clashes in variable names.


Com.mycompany.xslt.pdf
- content2pdf.xslt
<xsl:param name="com_mycompany_xslt_pdf_content2pdf_param1" select="'defaultvalue'"/>


Com.mycompany.xslt.html
  -content2html.xslt
      <xsl:param name="com_mycompany_xslt_html_content2html_param1" select="'anotherdefaultvalue'"/>

So if you would include both xslt's in another main.xslt you would at least have no confusion about parameters.

I have to say I don't follow this approach myself because I can oversee and am the only maintainer of the stylesheets. But if you were to write xslt's which would be used by 3rd parties this might not be such a bad approach.

What do you all think?

A parameter can have a qualified name so I would rather define some namespace in the stylesheet and put the parameter name in that namespace


  <xsl:stylesheet
    xmlns:pdf="http://example.com/pdf";
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    version="1.0">

<xsl:param name="pdf:param1"/>

--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread