开发者

XSLT PI and StyleSheet Parameters

Given an XSLT 1.x style sheet that requires parameters, is there any way to associate it with an XML document that specifies values for the parameters? I read the W3C spec document for the stylesheet PI and got left with the impression that the answer is 'no,' but I had a case of acute BNF poisoning by the time I was done, and thus might have missed something.

In more concrete terms, given:

<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>

is there any way to add some parameters t开发者_如何转开发hat will be bound to parameters of the style sheet?


Your analysis is correct. The xml-stylesheet PI provides no means to pass parameters to the XSL.

You could simply add some additional attributes or elements in the XML document that contain the values you would want to paramaterise.


Generally you want to associate a XML document with a XSLT template, not otherwise; you should go with this processing instruction:

<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>

Take a look here: Link the XSL Style Sheet to the XML Document and inspect source code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜