XSLT PI Parameters: Difference between revisions

redirect
No edit summary
 
(redirect)
 
(18 intermediate revisions by 7 users not shown)
Line 1: Line 1:
== Overview ==
#redirect [[mdc:XSLT:PI_Parameters]]
 
XSLT supports the concept of passing parameters to a stylesheet when executing it. This is currently possible when using the [http://www.mozilla.org/projects/xslt/js-interface.html XSLTProcessor in javascript]. However when using an <?xml-stylesheet?> processing instruction (PI) there is currently no way to provide parameters.
 
To solve this two new PIs are proposed, <?xslt-param?> and <?xslt-param-namespace?>. Both PIs can contain "pseudo attributes" the same way that the xml-stylesheet PI does.
 
The following document passes the two parameters "color" and "size" to the stylesheet "style.xsl".
 
<?xslt-param name="color" value="blue"?>
<?xslt-param name="size" select="2"?>
<?xml-stylesheet type="text/xsl" href="style.xsl"?>
 
== Processing instructions ==
 
The xslt-param PI supports 4 pseudo attributes:
 
* name<br>The local-name part of the parameter name.
* namespace<br>The namespace of the parameter name.
* value<br>The value of the parameter.
* select<br>An XPath expression for the parameter. The resulting value can be of any type.
Confirmed users
162

edits