This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Change an XSLT top-level parameter
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@NFER-NELSON.co.uk) 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@NFER-NELSON.co.uk"
> 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"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="stylesheet.xsl" />
<xsl:param name="p1" select="val1" />
<xsl:param name="p2" select="val2" />
<xsl:template match="xsl:stylesheet" />
</xsl:stylesheet>
...
</top-level-element>
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.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list