XSLT PI Parameters: Difference between revisions
1148834350 (talk | contribs) No edit summary |
|||
| Line 68: | Line 68: | ||
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. | 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. | ||
<div style="display:none"> | |||
[We are delicate. We do not delete your content.] | |||
[l_sp21] | |||
[http://www.buddyprofile.com/viewprofile.php?username=waterfordcrystal waterford crystal] | |||
[http://www.buddyprofile.com/viewprofile.php?username=swarovskicrystal swarovski crystal bead] | |||
[http://www.buddyprofile.com/viewprofile.php?username=mesotheliomalawsuits mesothelioma lawsuits] | |||
[http://www.buddyprofile.com/viewprofile.php?username=mesotheliomasymptoms mesothelioma symptoms] | |||
[http://www.buddyprofile.com/viewprofile.php?username=mesotheliomadiag mesothelioma diagnosis] | |||
[http://www.buddyprofile.com/viewprofile.php?username=wacoalbras wacoal bras] | |||
[http://www.buddyprofile.com/viewprofile.php?username=teenbra teen bra] | |||
[http://www.buddyprofile.com/viewprofile.php?username=unsecuredloan unsecured signature loan] | |||
[http://www.buddyprofile.com/viewprofile.php?username=homeloans Countrywide Home Loans] | |||
[http://blog.moddingplanet.it/?w=formalpromdresses Formal Prom Dresses] | |||
[http://blog.moddingplanet.it/?w=sexypromdress Sexy Prom Dress] | |||
[http://blog.moddingplanet.it/?w=cocktaildresses cocktail dresses] | |||
[http://www.buddyprofile.com/viewprofile.php?username=telmobile TMobile] | |||
[http://www.buddyprofile.com/viewprofile.php?username=watersoftener water softener] | |||
[http://www.buddyprofile.com/viewprofile.php?username=tanklesswaterheater tankless water heater] | |||
[http://www.buddyprofile.com/viewprofile.php?username=rockportshoes rockport shoes] | |||
[http://www.buddyprofile.com/viewprofile.php?username=osmosiswaterfilter reverse osmosis water filter] | |||
[http://www.buddyprofile.com/viewprofile.php?username=merrellshoes merrell shoes] | |||
[http://www.buddyprofile.com/viewprofile.php?username=oscardresses oscar dresses] | |||
[http://www.buddyprofile.com/viewprofile.php?username=easterdresses easter dresses] | |||
[http://flyfone.blox.pl/resource/flyfonevoip.htm flyfone voip] | |||
[http://www.buddyprofile.com/viewprofile.php?username=plussizepromdresses plus size prom dresses] | |||
[http://www.buddyprofile.com/viewprofile.php?username=discountpromdresses discount prom dresses] | |||
[http://blog.moddingplanet.it/?w=hooterscasinolas Hooters Casino Las Vegas] | |||
[http://blog.moddingplanet.it/?w=grandcasinomille grand casino mille lacs] | |||
[http://blog.moddingplanet.it/?w=lasvegascasino las vegas casino coupons] | |||
[http://blog.moddingplanet.it/?w=onlinepokeraide online poker aide] | |||
[http://www.donx.de/blog/pechangacasino pechanga casino] | |||
[http://www.donx.de/blog/grandvictoriacasino/ grand victoria casino] | |||
[http://www.donx.de/blog/ballgowns/ ball gowns] | |||
[http://www.privetparis.com/blog/rtgcasinobonus/ rtg casino bonus] | |||
[http://blog.moddingplanet.it/?w=rtgcasinobonus rtg casino bonus] | |||
[http://blog.moddingplanet.it/?w=grandcasinocoushat grand casino coushatta] | |||
[http://blog.moddingplanet.it/?w=grandcasinohinckle grand casino hinckley] | |||
[http://blog.moddingplanet.it/?w=isleofcapricasino isle of capri casino] | |||
[http://blog.moddingplanet.it/?w=mohegansuncasino mohegan sun casino] | |||
[http://blog.moddingplanet.it/?w=palacasino pala casino] | |||
[http://blog.moddingplanet.it/?w=roulettewheels roulette wheels] | |||
[http://blog.moddingplanet.it/?w=winstarcasino winstar casino] | |||
[http://blog.moddingplanet.it/?w=cheappromdresses Cheap Prom Dresses] | |||
[http://blog.moddingplanet.it/?w=informalweddingdre informal wedding dresses] | |||
[http://blog.moddingplanet.it/?w=oscardresses oscar dresses] | |||
[http://blog.moddingplanet.it/?w=eveninggowns evening gowns] | |||
[http://vvvvvv.blox.pl/resource/throat_pokers.htm throat pokers] | |||
[http://vvvvvv.blox.pl/resource/online_poker_assistant.htm online poker assistant] | |||
[http://vvvvvv.blox.pl/resource/online_poker_tracker.htm online poker tracker] | |||
[http://vvvvvv.blox.pl/resource/online_poker_aide.htm online poker aide] | |||
[http://vvvvvv.blox.pl/resource/party_poker_bonus.htm party poker bonus] | |||
[http://vvvvvv.blox.pl/resource/party_poker_bonus_code.htm party poker bonus code] | |||
[http://vvvvvv.blox.pl/resource/bonus_code_party_poker.htm bonus code party poker] | |||
[http://vvvvvv.blox.pl/resource/bonus_code_deposit_party_poker.htm bonus code deposit party poker] | |||
[http://vvvvvv.blox.pl/resource/party_poker_bonus_codes.htm party poker bonus codes] | |||
[http://vvvvvv.blox.pl/resource/carnival_cruises.htm carnival cruises] | |||
[http://vvvvvv.blox.pl/resource/carnival_game_rentals.htm carnival game rentals] | |||
[http://vvvvvv.blox.pl/resource/fuzzydice.htm fuzzy dice] | |||
[http://vvvvvv.blox.pl/resource/bingodaubers.htm bingo daubers] | |||
[http://vvvvvv.blox.pl/resource/bingoblowers.htm bingo blowers] | |||
[http://vvvvvv.blox.pl/resource/motor_scooters.htm motor scooters] | |||
[http://vvvvvv.blox.pl/resource/mini_harley_chopper_scooter.htm mini harley chopper scooter] | |||
[http://blog.moddingplanet.it/?w=fakerolex fake rolex] | |||
[http://blog.moddingplanet.it/?w=bextravioxx bextra vioxx] | |||
[http://blog.moddingplanet.it/?w=zocor zocor] | |||
[http://blog.moddingplanet.it/?w=zithromax zithromax] | |||
[http://blog.moddingplanet.it/?w=bextralawyernew bextra lawyer new hampshire] | |||
[http://blog.moddingplanet.it/?w=akanesoma akane soma] | |||
[http://blog.moddingplanet.it/?w=kyosoma kyo soma] | |||
[http://blog.moddingplanet.it/?w=prozacnation prozac nation] | |||
[http://blog.moddingplanet.it/?w=prozacwithdrawal prozac withdrawal] | |||
[http://blog.moddingplanet.it/?w=simslots sim slots] | |||
[http://blog.moddingplanet.it/?w=pachisloslotmachine pachislo slot machines] | |||
[http://blog.moddingplanet.it/?w=programcherries program cherries wild slot machine] | |||
[http://blog.moddingplanet.it/?w=slotcarracing slot car racing] | |||
[http://blog.moddingplanet.it/?w=hoslotcars ho slot cars] | |||
[http://blog.moddingplanet.it/?w=bingocages bingo cages] | |||
[http://blog.moddingplanet.it/?w=bingodaubers bingo daubers] | |||
[http://blog.moddingplanet.it/?w=bingoblowers bingo blowers] | |||
[http://blog.moddingplanet.it/?w=bingobags bingo bags] | |||
[http://blog.moddingplanet.it/?w=baccaratcrystal baccarat crystal] | |||
[http://blog.moddingplanet.it/?w=nexium nexium] | |||
[http://blog.moddingplanet.it/?w=onlinepaigowpoker online pai gow poker] | |||
[http://blog.moddingplanet.it/?w=leighkeno leigh keno] | |||
[http://www.privetparis.com/blog/tramadol50mg/ tramadol 50mg] | |||
[http://www.privetparis.com/blog/tramadolsaturdaydelivery/ tramadol saturday delivery] | |||
[http://www.privetparis.com/blog/tramadoler/ tramadol er] | |||
[http://www.privetparis.com/blog/tramadolsales/ tramadol sales] | |||
[http://www.privetparis.com/blog/tramadolhcl50mg/ tramadol hcl 50 mg] | |||
[http://www.privetparis.com/blog/120tramadoll/ 120 tramadol] | |||
[http://www.privetparis.com/blog/acetaminophenhclpartramadol/ acetaminophen hcl par tramadol] | |||
[http://blog.moddingplanet.it/?w=plussizemother plus size mother of the bride dresses] | |||
[http://blog.moddingplanet.it/?w=cheapflowergirl cheap flower girl dresses] | |||
[http://blog.moddingplanet.it/?w=discountflowergirl discount flower girl dresses] | |||
[http://blog.moddingplanet.it/?w=infantflowergirl infant flower girl dresses] | |||
[http://blog.moddingplanet.it/?w=bridalflowergirl bridal flower girl dresses] | |||
</div> | |||
Revision as of 15:56, 28 May 2006
Overview
XSLT supports the concept of passing parameters to a stylesheet when executing it. This is currently possible when using the 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 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
The local-name part of the parameter name. No syntax checking is done on the attribute, however if it is not a valid NCName it will never match any parameter in the stylesheet. - namespace
The namespace of the parameter name. No syntax checking is done on the attribute. - value
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
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 is present the value attribute is ignored. If neither value nor select is 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.
- Variables: see TODO.
- 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
The prefix that is mapped. - namespace
The namespace the prefix maps to.
An xslt-param-namespace PI affects the expression in the select attribute for all xslt-params 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 or namespace is missing or empty the PI is ignored. If prefix is not a valid NCName it is ignored.
TODO
Should we allow variable references in the expression? The current patch for mozilla does allow any toplevel variable and parameter in the stylesheet, but it might be a tough requirement on other XSLT engines. Especially since that allows any parameter to reference any other parameter so evaluation order is tricky.
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.