[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] initial template parameters


Subject: RE: [xsl] initial template parameters
From: "Robby Pelssers" <robby.pelssers@xxxxxxxxx>
Date: Thu, 18 Mar 2010 16:06:33 +0100

mmm...

another useful lesson learned ;-)

Thx for that info Martin.


-----Original Message-----
From: Martin Honnen [mailto:Martin.Honnen@xxxxxx]
Sent: Thursday, March 18, 2010 4:02 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] initial template parameters

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