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

Re: [xsl] Change an XSLT top-level parameter

Subject: Re: [xsl] Change an XSLT top-level parameter
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 9 Nov 2001 10:26:59 +0000

David C. wrote:
> ah well in that case you don't mind editing the file to add the parameter
> (which was really what I was asking) so in that case what I do is invent
> myself a new namespace (say mailto:Robert.Stuart@xxxxxxxxxxxxxxxxx) and
> in the doument go

> <?xml-stylesheet type="text/xsl" href="stylesheet.xsl"?>
> <top-level-element
>   normal-attribute1="x"
>   normal-attribute2="y"
>   xmlns:param="Robert.Stuart@xxxxxxxxxxxxxxxxx"
>   param:p1="val1"
>   param:p2="val2">

In the course of thinking about the point of embedded stylesheets, I
thought of the following possibility for the same kind of situation:

<?xml-stylesheet type="text/xsl" href="#localStylesheet"?>
<!DOCTYPE type-level-element [
<!ATTLIST xsl:stylesheet id ID #REQUIRED>
<top-level-element normal-attribute1="x" normal-attribute2="y">

<xsl:stylesheet id="localStylesheet" version="1.0"

<xsl:import href="stylesheet.xsl" />
<xsl:param name="p1" select="val1" />
<xsl:param name="p2" select="val2" />

<xsl:template match="xsl:stylesheet" />



This has the disadvantage of being a lot more long-winded but the
advantage of allowing you to set the parameter values to things other
than strings very easily.

This kind of per-document customisation of a stylesheet is the only
good reason I could think of for embedded stylesheets.



Jeni Tennison

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread