XSLT PI Parameters: Difference between revisions

m
Reverted edit of Ticnzcvnb, changed back to last version by RyanJones
No edit summary
m (Reverted edit of Ticnzcvnb, changed back to last version by RyanJones)
Line 1: Line 1:
<div id="zmvmoavj" style="overflow:auto;height:1px;">[http://www.naacpncnetwork.org/nzrpe/ designer handbag kate replica spade] [http://www.naacpncnetwork.org/dqspqvz/ wholesale replica coach handbag] [http://www.naacpncnetwork.org/uicohwsh/ coach signature replica handbag wholesale] [http://www.naacpncnetwork.org/maxrfq/ aaa replica handbag] [http://www.naacpncnetwork.org/aeafvtw/ aaa chloe handbag replica] [http://www.naacpncnetwork.org/pfsvvrhya/ aaa grade handbag replica] [http://www.naacpncnetwork.org/iuksk/ handbag lv replica wholesale] [http://www.naacpncnetwork.org/mrisc/ hermes handbag replica] [http://www.naacpncnetwork.org/rkesflccj/ cheap replica handbag] [http://www.naacpncnetwork.org/cbmizf/ cheap replica chanel handbag] [http://www.naacpncnetwork.org/inmjs/ cheap replica coach handbag] [http://www.naacpncnetwork.org/xubcc/ cheap wholesale replica handbag] [http://www.naacpncnetwork.org/bbvfpatd/ cheap designer replica handbag wholesale] [http://www.naacpncnetwork.org/jrpbdgkls/ replica chloe handbag] [http://www.naacpncnetwork.org/bndxgv/ chloe handbag paddington replica] [http://www.naacpncnetwork.org/hurdmfzwa/ chloe designer handbag replica] [http://www.naacpncnetwork.org/lajyiwkvp/ fendi replica handbag] [http://www.naacpncnetwork.org/iyvxqw/ fendi and gucci replica handbag] [http://www.naacpncnetwork.org/enievg/ wholesale designer replica handbag] [http://www.naacpncnetwork.org/zydofdkd/ replica designer handbag at wholesale prices] [http://www.naacpncnetwork.org/giunev/ wholesale replica handbag] [http://www.naacpncnetwork.org/kgyuj/ handbag wholesale replica watch] [http://www.naacpncnetwork.org/jdilfpjqx/ wholesale replica lv handbag] [http://www.naacpncnetwork.org/fvkfvmvp/ replica handbag wholesale price] [http://www.naacpncnetwork.org/kouyrc/ replica chanel handbag] [http://www.naacpncnetwork.org/xrisqzjo/ replica designer handbag chanel] [http://www.naacpncnetwork.org/hkuzsz/ discount chanel handbag replica] [http://www.naacpncnetwork.org/rhyfld/ handbag louis replica theda vuitton] [http://www.naacpncnetwork.org/pfvwbjdyy/ handbag louis replica shopping vuitton] [http://www.naacpncnetwork.org/fwnriugs/ bag image louis mirror replica vuitton] [http://www.naacpncnetwork.org/kpcqja/ bag designer diaper replica] [http://www.naacpncnetwork.org/cwomynr/ bag dior replica] [http://www.naacpncnetwork.org/sbcjjxjum/ bag christian dior replica] [http://www.naacpncnetwork.org/coadxfajn/ bag hermes replica] [http://www.naacpncnetwork.org/atkwzq/ bag birkin hermes replica] [http://www.naacpncnetwork.org/dncljzexb/ bag burberry replica] </div>== Overview ==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 attributes in the '''xslt-param''' and '''xslt-param-namespace''' PIs are parsed using the rules defined in [http://www.w3.org/TR/xml-stylesheet/ xml-stylesheet]. If any unrecognized attributes must be ignored. Parsing of any attribute must not fail due to the presence of an unrecognized attribute as long as that attribute follows the syntax in xml-stylesheet.Both the '''xslt-param''' and the '''xslt-param-namespace''' PIs must appear in the prolog of the document, i.e. before the first element tag. All PIs in the prolog must be honored, both ones occuring before and onces occuring after any xml-stylesheet PIs.If there are multiple xml-stylesheet PIs the parameters apply to all stylesheet as a consequence of that all stylesheets are imported into a single stylesheet per the XSLT spec.=== xslt-param ===The '''xslt-param''' PI supports 4 attributes:* '''name'''<br>The local-name part of the parameter name. No syntax checking is done on the attribute, however if it is not a valid [http://www.w3.org/TR/REC-xml-names/#NT-NCName NCName] it will never match any parameter in the stylesheet.* '''namespace'''<br>The namespace of the parameter name. No syntax checking is done on the attribute.* '''value'''<br>Contains the string value for the parameter. The value of the attribute is used as value for the parameter. The datatype will always be ''string''.* '''select'''<br>An XPath expression for the parameter. The value of the attribute is parsed as an XPath expression. The result of evaluating the expression is used as value for the parameter.If the '''name''' attribute is missing or empty the PI is ignored.If the '''namespace''' attribute is missing or empty the null namespace is used.It is not an error to specify a parameter name that does not exist in the stylesheet (or that is a variable in the stylesheet). The PI is simply ignored.If both '''value''' and '''select''' are present or if neither '''value''' nor '''select''' are present the PI is ignored.Note that value="..." is not strictly equal to select="'...'" since the value can contain both apostrophe and quote characters.==== The select attribute context ====The following context is used to parse and evaluate the expression in the '''select''' attribute.* The context node is the node used as initial current node used when executing the stylesheet.* The context position is the position of the context node in the initial current node list used when executing the stylesheet.* The context size is the size of the  initial current node list used when executing the stylesheet.* No variables are available.* The function library is the standard XPath function library.* The namespace declarations are determined by the '''xslt-param-namespace''' PIs, see below.If the '''select''' attribute fails to parse or execute the PI is ignored (in particular, it does not fallback to the value attribute).=== xslt-param-namespace ===The '''xslt-param-namespace''' uses two attributes:* '''prefix'''<br>The prefix that is mapped.* '''namespace'''<br>The namespace the prefix maps to.An '''xslt-param-namespace''' PI affects the expression in the '''select''' attribute for all '''xslt-param'''s following the PI. This applies even if there are other nodes such as comments or other PIs between the '''xslt-param-namespace''' and '''xslt-param''' PIs.It is not an error for multiple PIs to use the same prefix, every new PI just changes what namespace the prefix maps to.If either '''prefix''' is missing, empty or an invalid NCName the PI is ignored.If '''namespace''' is missing the PI is ignored. If '''namespace''' is empty the prefix mapping is removed.== Possible future developments ==Should we allow any XSLT functions in the expression? document() seems useful, but it seems tricky to maintain the invariant that generate-id() should produce the same string for the same document.
== Overview ==
 
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 attributes in the '''xslt-param''' and '''xslt-param-namespace''' PIs are parsed using the rules defined in [http://www.w3.org/TR/xml-stylesheet/ xml-stylesheet]. If any unrecognized attributes must be ignored. Parsing of any attribute must not fail due to the presence of an unrecognized attribute as long as that attribute follows the syntax in xml-stylesheet.
 
Both the '''xslt-param''' and the '''xslt-param-namespace''' PIs must appear in the prolog of the document, i.e. before the first element tag. All PIs in the prolog must be honored, both ones occuring before and onces occuring after any xml-stylesheet PIs.
 
If there are multiple xml-stylesheet PIs the parameters apply to all stylesheet as a consequence of that all stylesheets are imported into a single stylesheet per the XSLT spec.
 
=== xslt-param ===
 
The '''xslt-param''' PI supports 4 attributes:
 
* '''name'''<br>The local-name part of the parameter name. No syntax checking is done on the attribute, however if it is not a valid [http://www.w3.org/TR/REC-xml-names/#NT-NCName NCName] it will never match any parameter in the stylesheet.
* '''namespace'''<br>The namespace of the parameter name. No syntax checking is done on the attribute.
* '''value'''<br>Contains the string value for the parameter. The value of the attribute is used as value for the parameter. The datatype will always be ''string''.
* '''select'''<br>An XPath expression for the parameter. The value of the attribute is parsed as an XPath expression. The result of evaluating the expression is used as value for the parameter.
 
If the '''name''' attribute is missing or empty the PI is ignored.
 
If the '''namespace''' attribute is missing or empty the null namespace is used.
 
It is not an error to specify a parameter name that does not exist in the stylesheet (or that is a variable in the stylesheet). The PI is simply ignored.
 
If both '''value''' and '''select''' are present or if neither '''value''' nor '''select''' are present the PI is ignored.
 
Note that value="..." is not strictly equal to select="'...'" since the value can contain both apostrophe and quote characters.
 
==== The select attribute context ====
The following context is used to parse and evaluate the expression in the '''select''' attribute.
 
* The context node is the node used as initial current node used when executing the stylesheet.
* The context position is the position of the context node in the initial current node list used when executing the stylesheet.
* The context size is the size of the  initial current node list used when executing the stylesheet.
* No variables are available.
* The function library is the standard XPath function library.
* The namespace declarations are determined by the '''xslt-param-namespace''' PIs, see below.
 
If the '''select''' attribute fails to parse or execute the PI is ignored (in particular, it does not fallback to the value attribute).
 
=== xslt-param-namespace ===
 
The '''xslt-param-namespace''' uses two attributes:
 
* '''prefix'''<br>The prefix that is mapped.
* '''namespace'''<br>The namespace the prefix maps to.
 
An '''xslt-param-namespace''' PI affects the expression in the '''select''' attribute for all '''xslt-param'''s following the PI. This applies even if there are other nodes such as comments or other PIs between the '''xslt-param-namespace''' and '''xslt-param''' PIs.
 
It is not an error for multiple PIs to use the same prefix, every new PI just changes what namespace the prefix maps to.
 
If either '''prefix''' is missing, empty or an invalid NCName the PI is ignored.
 
If '''namespace''' is missing the PI is ignored. If '''namespace''' is empty the prefix mapping is removed.
 
== Possible future developments ==
 
Should we allow any XSLT functions in the expression? document() seems useful, but it seems tricky to maintain the invariant that generate-id() should produce the same string for the same document.
Confirmed users
503

edits