xsl-list
[Top] [All Lists]

Re: [xsl] initial template parameters

2010-03-18 10:02:37
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/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--